$index = $('#Index'); $val = parseInt($index.val()); $val--;
Use $val On Feb 11, 9:37 am, shapper <mdmo...@gmail.com> wrote: > You mean the following: > > $index = $('#Index'); > parseInt($index.val())--; > > This still gives me the same error. > > Could someone, please, tell me how to do this? > > Thanks, > Miguel > > On Feb 11, 6:38 am, Ralph Whitbeck <ralph.whitb...@gmail.com> wrote: > > > Karl is right, you need to convert it from a string first. > > > shapper wrote: > > > Hello, > > > > I have an input on my page as follows: > > > > <input id="Index" name="Index" type="hidden" value="0" /> > > > > I am trying to increase and decrease the value of the input as > > > follows: > > > > $index = $('#Index'); > > > $index.val()--; > > > > I always get an error: > > > invalid assignment left-hand side > > > > What am I doing wrong? > > > > Thanks, > > > Miguel