How to disable browser autofill on input fields using jQuery ? Last Updated : 21 Dec, 2020 Comments Improve Suggest changes Like Article Like Report In this article, we will see how to disable the browser auto fill property on the input field. For that, HTML page is created in which jQuery CDN is imported to use jQuery and its code is written. Approach: Create a basic HTML page having at least one input field in it with the "id" attribute.Import jQuery CDN from script tag to use jQuery on the page. Then write the jQuery code in the script tag for disabling autofill on the input field. To achieve this, we use two methods of jQuery to set the attribute value to the field: attr() Method prop() method Example 1: Using attr() method html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width,initial-scale=1.0"> <!-- Import jQuery cdn library --> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script> <script> // Execute this code when page is // totally loaded $(document).ready(function () { /* Setting the autocomplete of input field to off to make autofill to disable */ $("#name").attr("autocomplete", "off"); }); </script> </head> <body> <label for="name">Name:</label> <input type="text" name="name" id="name"> </body> </html> Output: This will be output of code Example 2: Using prop() method html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title>Disable Autofill</title> <!-- Import jQuery cdn library --> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script> <script> // Execute this code when page is // totally loaded $(document).ready(function () { /* Setting the autocomplete of input field to off to make autofill to disable */ $("#name").prop("autocomplete", "off"); }); </script> </head> <body> <label for="name">Name:</label> <input type="text" name="name" id="name"> </body> </html> Output: Output of code. In this field there is no autofill Comment More infoAdvertise with us Next Article How to disable browser autofill on input fields using jQuery ? A anurag702 Follow Improve Article Tags : Web Technologies HTML JQuery jQuery-Misc Similar Reads How to create a Disabled Input using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Input using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=âstylesheetâ hre 1 min read How to disable browser Autocomplete on web form field/input tag? Input text autocomplete is the default feature of any browser. While working with the form or input fields in HTML web page autocomplete feature of the browsers come in the picture. By default autocomplete is enabled in browsers so when submitting the form it remembers the information. So when again 2 min read How to detect browser autofill using JavaScript? We will learn how to detect browser autofill using javascript. Here we are going to use 3 programming languages HTML, CSS, Jquery to solve this problem in the best and well-defined way. In all web browser autofill is the feature that automatically fills the form fields such as email, address, passwo 4 min read How to select all on focus in input using JQuery? The select() event is applied to an element using jQuery when the user makes a text selection inside an element or on focus the element. This event is limited to some fields. Syntax: $("selected element").select(); //Select all Input field on focus $("input").select(); //Select Input field on focus 1 min read How to enable/disable all input controls inside a form element using jQuery ? Give an HTML document containing a form element. The form element contains input elements, option elements, and button elements. The task is to enable or disable all input controls inside a form using jQuery. It can be done by using prop() method. Using prop() Method: It is used to set or return the 3 min read Like