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;

On Feb 11, 2:37 pm, 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

Reply via email to