Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide a text input's browser-generated dropdown list of previous items [duplicate]

When I generate a text input like this:

<input type="text" name="name" /> 

When I start to type, the browser will display a dropdown list below the text input. This list contains the values I previously used for this text input in this browser. I want to generate my own autocompletion via ajax.

How do I tell the browser with either css or javascript to not generate this dropdown list.

If this task is easier by using jquery, I would prefer such a solution.

like image 928
johannes Avatar asked Sep 25 '09 14:09

johannes


People also ask

How do I remove previous inputs?

That solution helped me: if you are using google Chrome, try this: Put the mouse pointer on the entry that you want to delete, press Delete . If the entry is not removed, press Shift + Delete .

How do you hide a drop down list in CSS?

Answer: Use the CSS :hover pseudo-class If you simply want to show and hide dropdown menu on mouse hover you don't need any JavaScript. You can do this simply using the CSS display property and :hover pseudo-class.

How do I get rid of HTML suggestions?

Add autocomplete="off" onto <form> element; Add hidden <input> with autocomplete="false" as a first children element of the form.

Which tag is used to disable suggestions while giving input?

Use the <input> tag with autocomplete attribute. Set the autocomplete attribute to value “off”.


1 Answers

Both IE and Firefox (maybe others, I didn't research it much) support the autocomplete attribute. If you set it to "off" these browsers will no longer display the autocompletion.

<input type="text" autocomplete="off" /> 
like image 109
Peter Bailey Avatar answered Sep 30 '22 07:09

Peter Bailey