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 How to Disable an datepicker in jQuery UI ? To disable a datepicker in jQuery UI we will be using disable() method which is discussed below: jQuery UI disable() method is used to disable the datepicker. Syntax: $( ".selector" ).datepicker( "disable" )Parameters: This method does not accept any parameters. Return values: This method returns an 1 min read How to disable autocomplete of an HTML input field ? In this article, we will learn how to disable or off autocomplete features of a particular input field in HTML form. As we know the autocomplete feature is used to allow a browser to automatically complete the input data value based on the values that the user entered before. The latest browsers sup 1 min read How to create a Text 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 a Text Input using jQuery Mobile. Approach: First, we add the jQuery Mobile scripts needed for the project. <link rel=âstylesheetâ hre 1 min read How to disable form submit on enter button using jQuery ? There are two methods to submit a form, Using the "enter" key: When the user press the "enter" key from the keyboard then the form submit. This method works only when one (or more) of the elements in the concerned form have focus. Using the "mouse click": The user clicks on the "submit" form button. 2 min read How to Allow Only Special Characters and Spaces in Text Field Using jQuery ? We are going to create an input box that only contains the special characters and the space as the input. It will show an error if any other character is entered. We will use regular expressions that consist of only special symbols and spaces with different events in jQuery. Table of Content Using r 3 min read Like