hidden inputs fields are always strings(chars)?

Hi,

I am trying to implement wizard for my application. I am doing it with hidden divs. For navigation purposes: I am using hidden input fields such as: <input id="wizard_current_state" name="state" type="hidden" value = 1 /> <input id="wizard_previous_state" name="state" type="hidden" value = 1 />

So that when someone presses next, i can increment the current_state to 2 in JavaScript Function that i have written.

$('wizard_previous_state').value = previous = $('wizard_current_state').value current = $('wizard_current_state').value = previous + 1

But "previous + 1 " is evaluated as 1 + 1 = 11 (string concat).

How do i say that i want hidden value to be integer?

Any suggestions?

Regards, Sandeep G

I'm pretty sure that the values of fields are always strings. But you should be able to do what you want with something like

current = $(wizard_current_state).value = +previous + 1

In Javascript, using a unary + operator on a string containing a number will produce the number.

Thanks Rick. That helps.