Try this: "5"-2 == 3; If you need to increment you can't just use a '+' to convert the string, or parseInt/Number as everyone already pointed out.
shapper: $index = $('#Index'); $index.val( +$index.val()+1 ); cheers, - ricardo On Feb 11, 4:47 pm, brian <bally.z...@gmail.com> wrote: > On Wed, Feb 11, 2009 at 1:23 PM, Ricardo Tomasi <ricardob...@gmail.com> wrote: > > > Increment/decrement is for variables. You can't use it directly on a > > number. Try '3--'. > > > Make it simple, if you use subtraction the type conversion is done for > > you: > > > $index = $('#Index'); > > val = $index.val()-1; > > Except, as Karl pointed out, val() will return a string. > > var val = parseInt($index.val()); > $index.val(--val);