最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to cancel editdisable cached input (of type text) value? - Stack Overflow

programmeradmin3浏览0评论

I have an input of type text, from which I have already entered value 1234
it has been saved in cache as shown below.

The problem here is that, it is extremely frustrating to select the textbox in the next row.

Is there a way to not to display that 12334 (highlighted in the screenshot) from ever being displayed through HTML markup or javascript?

I have an input of type text, from which I have already entered value 1234
it has been saved in cache as shown below.

The problem here is that, it is extremely frustrating to select the textbox in the next row.

Is there a way to not to display that 12334 (highlighted in the screenshot) from ever being displayed through HTML markup or javascript?

Share Improve this question edited Feb 8, 2017 at 14:16 CommunityBot 11 silver badge asked Oct 20, 2009 at 3:47 dance2diedance2die 36.9k39 gold badges135 silver badges197 bronze badges 1
  • I did not change the title to "How to disable Autocomplete because there might be other people who are unaware of Autocomplete attribute option. – dance2die Commented Oct 20, 2009 at 13:37
Add a comment  | 

3 Answers 3

Reset to default 11

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');
});
发布评论

评论列表(0)

  1. 暂无评论