Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript: Prevent browser to display input history for a field on press of down key

Tags:

Is there anyway to prevent the browser from displaying previously inputted values for a field on press of the down key?

If this is not possible, another problem of mine is on press of the down key, the list of previously inputted values will be shown and on press of the TAB key, the currently highlighted value on the list will be chosen and will be set as the value of the field. I do not want this, I just want the focus to be passed to the next input element w/o choosing any values.

Are there any ways to override the browser behavior? A solution in play javascript is preferred though jQuery solutions are fine as well. Thanks!

like image 714
Ram Avatar asked Jul 16 '13 07:07

Ram


2 Answers

Just add the autocomplete attribute

<input type="text" autocomplete="off" /> 
like image 119
adeneo Avatar answered Sep 28 '22 01:09

adeneo


You can disable autocomplete by adding autocomplete="off" onto your input tags. MDN Reference

Example

<input type="text" name="email" value="" autocomplete="off" /> 

See this Stack Overflow post for browser compatibility.

like image 33
CodingIntrigue Avatar answered Sep 28 '22 00:09

CodingIntrigue