Firefox has a very annoying feature. It remembers the state of input fields when you hit F5. It's not just the value, it remembers even whether the input is disabled or not.
Example:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
</head>
<body>
<input type="text" value="textbox" />
<a href="#" onclick="javascript: $('input').attr('disabled', true); return false; " >Disable text box</a>
</body>
</html>
The code above has an anchor that, when clicked, disables the text input field. After that, Firefox will remember the state after F5 and the only way to restore it to the original is to hit enter on the address bar.
Is there a meta tag or something to make FF stop doing that?
EDIT
Actually browsers have different behaviors. Firefox is the most annoying. Firefox remembers the input value and whether it's disabled or not. IE8 remembers the value and Chrome doesn't remember anything
You can set the element or the form to autocomplete="off"
to disable state preservation, but that also disables input autocomplete, of course.
I do think all browsers have that feature.
But to reset your input to its original value, try this.
$('document').ready(function(){//or whenever you want to fire back to the default value
$('input#withanidplease').val($('input#withanidplease').prop('defaultValue'))
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With