Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery disable autocomplete in input

I have this code:

The html:

<input id="register_username" type="text"> <input id="register_password" type="text"> <input id="register_repeatpassword" type="text"> <input id="register_email" type="text"> 

The Jquery:

$(document).ready(function(){     $('#register_username').attr('autocomplete','off');     $('#register_password').attr('autocomplete','off');     $('#register_repeatpassword').attr('autocomplete','off');     $('#register_email').attr('autocomplete','off');     }); 

I want to disable the autocomplete feature offred by some browsers and acctually make the user type the entire field but the code is not working the dropdown menu still appear and the user still able to choose stuff the typed before. I also tried to user autocomplete="off" but nothing happened. What am I doing wrong here ?

like image 645
Max Pain Avatar asked Dec 29 '12 02:12

Max Pain


People also ask

How do I turn off autocomplete input?

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

How do I stop autofill in Chrome using jquery?

Sept 2020: autocomplete="chrome-off" disables Chrome autofill. Original answer, 2015: For new Chrome versions you can just put autocomplete="new-password" in your password field and that's it. I've checked it, works fine.

How do I turn off auto suggestion in HTML?

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

How do you show the suggestion list in the input field?

Approach: Create a div with the class as a container. Inside of this div, create another div with a class as a text-container that will contain the <input> tag & <datalist> tag. Declare the list attribute as programmingLanguages inside the <input> tag.


1 Answers

Just add:

autocomplete="off" 

as attributes to the INPUT elements, f.ex:

<input autocomplete="off" id="register_username" type="text" name="username"> 
like image 72
David Hellsing Avatar answered Sep 21 '22 17:09

David Hellsing