How to cancel edit/disable cached input (of type text) value?
I have an input of type text
, from which I have already entered value 1234
The problem here is that, it is extremely frustrating to select the textbox in the next row.
Is there a way to not to di开发者_JS百科splay that 12334
(highlighted in the screenshot) from ever being displayed through HTML markup or javascript?
As @John pointed out, on modern browsers you can use the HTML5 valid autocomplete
attribute, in your screenshot I see many textboxes, if you want to disable autocompletion on the whole form you can set this attribute directly at the form
element:
<form name="form1" id="form1" method="post" autocomplete="off"
action="http://www.example.com/form.action">
[...]
</form>
More info:
- How to Turn Off Form Autocompletion
<input type="text" name="input" autocomplete="off" />
To apply this to all input controls, write the code below (using jQuery):
$(document).ready(function () {
$('input[type=text], input[type=password]').attr('autocomplete', 'off');
});
精彩评论