parseInt(): http://www.w3schools.com/jsref/jsref_parseInt.asp
Example: var sNum = "1234"; var n = parseInt(sNum, 10); // 10 means base-10 number sytem On Jul 13, 11:20 am, macjohn <ba...@basix.dk> wrote: > It worked! > Thanks a million!! > > OK now that I am asking syupid questions: > > I pick up variables from the form using Jquery: > > var element = $(this); > var Id = element.attr("id"); > var item = $('#vare_'+Id).val(); > var other_item = $('#other_vare_'+Id).val(); > > And I would like to add these two variables to eachother. > But if the first one = 1 > and th other =2 > > and I add them like this: > third = item + other_item; > I get: third = 12 > > So apparently the script regards my vars as strings and not numbers. > How can I tell my script that they are numbers and not a string, so > that I can add them correctly? > > On 13 Jul., 22:54, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > > > If linking to the google api works, that's no problem. > > I tend to have a particular version on my server so if a new > > version comes out that breaks functionality in some code or > > another plugin, I'm not affected by the change and can test > > the new code before it affects my sites. > > > As far as using the .live function, try this: > > > $('.koeb').live('click', function() { etc... > > > That should keep the click functionality on .koeb "alive" > > as the DOM elements are change via jQuery. > > > -----Original Message----- > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > Behalf Of macjohn > > Sent: Monday, July 13, 2009 4:47 PM > > To: jQuery (English) > > Subject: [jQuery] Re: Why does my Jquery elements handles not work? > > > I usehttp://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js > > Instead of keeping a version of the library myself. Is that a bad > > idea? (I just thought Id always have the latest version this way) > > > BUT > > This is where it REALLY shines thorough that I dont know what I am > > talking about: > > > I dont know how to use live() > > > When this was (part of) my code: > > > $(".koeb").click(function(){ > > var element = $(this); > > var Id = element.attr("id"); > > > $("#shop_togglebox_1_"+Id).html('<input type="submit" class="afbestil" > > value="Remove element" id="'+Id+'">'); > > > How do I use live() ? > > > On 13 Jul., 22:34, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > > > If you're using jQuery 1.3 or above, it has a built-in function, .live(), > > > that > > > does almost the same thing are the .livequery plugin. However, .live() is > > a > > > little > > > more limited as to the type of events it effects, such as blur. Go with > > the > > > .live() > > > function if you can and avoid having to use another plug-in. But if > > .live() > > > doesn't > > > work for the trigger (such as .blur), then use the plug-in, livequery. > > > > -----Original Message----- > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > > Behalf Of macjohn > > > Sent: Monday, July 13, 2009 4:23 PM > > > To: jQuery (English) > > > Subject: [jQuery] Re: Why does my Jquery elements handles not work? > > > > oh, ok. I need a plugin to do this? Ok, great Ill check it out. Thanks > > > > On 13 Jul., 22:16, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > > > > Check out the .livequery plug-in or, for jQuery 1.3 and above, the > > .live() > > > > function. > > > > > -----Original Message----- > > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > > > Behalf Of macjohn > > > > Sent: Monday, July 13, 2009 4:12 PM > > > > To: jQuery (English) > > > > Subject: [jQuery] Why does my Jquery elements handles not work? > > > > > Hi all! > > > > > I am a newbie in Jquery. > > > > And I have encountered a problem: > > > > > Using Jquery, I am replacing a submit button with a different submit > > > > button. > > > > > So far so good. It works and looks right, in the generated sourcecode > > > > (when checking it in Firebug). > > > > > HOWEVER: > > > > The new generated submit button does NOT trigger my JQuery script?! > > > > If I refresh the page, so that the exact same button is being > > > > generated by php, - my Jquery script fires and works perfectly..... > > > > whats up with that? > > > > > I also notice that if I have JQuery generate a regular mouseover on an > > > > image event - the mouseover-Javascript does not fire, when the image > > > > and handles are generated by Jquery. (again, the generated sourcecode > > > > looks correct). > > > > > I generate like this: > > > > On the submitbutton that I want to replace I have a unique class-name > > > > and unique numer on "id". > > > > > Snip from JQuery script: > > > > $(".koeb").click(function(){ > > > > var element = $(this); > > > > var Id = element.attr("id"); > > > > > $("#shop_togglebox_1_"+Id).html('<input type="submit" class="afbestil" > > > > value="Remove element" id="'+Id+'">'); > > > > > And this looks correct on the screen, and the css sees the class > > > > "afbestil" and does all the correct styling. > > > > BUT the script corresponding to the class "afbestil" does not fire. > > > > > Unless I refresh the page. The PHP generates the exact same submit > > > > button, with alle the same properties. And NOW the Jquery fires..... > > > > > Can anyone help? > >