I am facing a weird problem, may be some of you have already faced it. Here is the issue,
I have a hidden input field in my html ( using perl /mason ),
<input type='hidden' id='noB' name='noB' value='<% $noB%>'/> ;
value ($noB
) is filled at server side.
In my javascript, I am using
var noB = jQuery('#noB').val();
to get value and process it.
Most important thing is everytime I will access this value inside a javascript function in a new variable assume noB = 3
, do some processing and update the hidden variable noB
with new value as 1, so its not a global variable which I am using to do that.
Now, if I change noB
lets say 1 in my javascript and after that page is refreshed using F5, when the page loads again and I try to get value.
var noB = jQuery('#noB').val();
I get noB = 1
only, when It should be 3.
Please help.
Firefox (and possibly other browsers) will reload form elements with the values they had when you refreshed the page, even if that's not the value specified in the HTML. Simple solution: reload the page by navigating back to it, rather than refreshing.