I want to change the default value of an input box such that when I reset the form, the value remains.
I have the following code that sets a value using jQuery but as reset is pressed, the value becomes the initial one.
<form>
Email: <input type="text" id="email" value="old value" />
<input type="reset" value="reset" />
</form>
$(function(){
$("#email").val("New value");
});
Reset clears all values of the form (default behaviour). If you want the values to be visible again, you need to set them again. So you need to call a method onclick of the reset button and fill the form again.