Oh, right! I knew that looked like a bad idea in the first place.

On Tue, Feb 10, 2009 at 9:46 PM, Karl Rudd <karl.r...@gmail.com> wrote:
>
> Remember also that .val() will return a string, so you'll need to
> convert it to a number first (parseInt), then decrement it.
>
> Karl Rudd
>
> On Wed, Feb 11, 2009 at 1:14 PM, brian <bally.z...@gmail.com> wrote:
>>
>> $index.val() returns the value. $index.val(VALUE); assigns VALUE.
>>
>> So, this should (might) work:
>>
>> $index.val(--$index.val())
>>
>> It doesn't look so great, though. I say "might" because I'm not sure
>> if that needs to be set as a var, first.
>>
>> You also want the decrement on the left or you'll be decrementing the
>> value after you assign it, where the decrement will not have any
>> effect (because the pre-decremented value was assigned).
>>
>>
>>
>> On Tue, Feb 10, 2009 at 9:07 PM, shapper <mdmo...@gmail.com> 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