Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input elements should have autocomplete attributes

I am getting this message in the console I can't understand it. Please look into it

    <!DOCTYPE html> <html> <head>     <title>registration page</title>         <script src="js/jquery.js"></script>     <script type="text/javascript">         $(document).ready(function(){         $('form').submit(function(event){     "use strict";         var valid = true,         message = '';                 $('.error').remove();               $('form input').each(function() {         var $this = $(this);            if(!$this.val()) {             message='';             var inputName = $this.attr('name');             valid = false;             message += 'Please enter your ' + inputName + '\n';             $(this).closest('div').append('<div class="error">'+message+'</div>');                    } })            if(!valid){                 event.preventDefault();         }else{ $('form').serialize()         } }) })     </script> </head> <body> <form> <div>     <label>Name</label>     <input type="text" name="name"><br> </div> <div>     <label>File</label>     <input type="file" name="file"><br> </div> <div>     <label>password</label>     <input type="password" name="password"><br> </div> <button type='submit'>Submit</button> </form> </body> </html> 

The problem is despite no error I keep getting this message

[DOM] Input elements should have autocomplete attributes (suggested: "current-password"):  

I have been provided with a google link in console which take me to (More info: goo.gl/9p2vKq)

like image 568
vinayak shahdeo Avatar asked Mar 03 '19 15:03

vinayak shahdeo


People also ask

Which attribute is used to provide an autocomplete?

The autocomplete attribute specifies whether a form or an input field should have autocomplete on or off. Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values.

Is autocomplete an attribute?

The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.

Which element provide the autocomplete feature in a textbox?

The <datalist> tag is used to provide an "autocomplete" feature for <input> elements.


2 Answers

Try changing

<input type="password" name="password"> 

to

<input type="password" name="password" autocomplete="on"> 

Autocomplete lets web developers specify what (if any) permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.

It's pretty powerful.

like image 179
dearsina Avatar answered Sep 21 '22 21:09

dearsina


Turning off Autocomplete

You have the below options for working with errors of the below format Input elements should have autocomplete attributes thrown by the console by modifying:

<input type="password" name="password"> 
  1. Set the autocomplete attribute to off at the <form> or <input> which:
    • Enforces browser to NOT store any data
    • Disables caching form data in the session history
<input type="password" name="password" autocomplete="off"> 
  1. Another way to prevent autofilling by the browser is:
    The below suggestions are browser specific
<input type="password" name="password" autocomplete="new-password"> <!-- For Mozilla--> <!-- or --> <input type="password" name="password" autocomplete="current-password"> <!-- For Chrome--> 
like image 40
RICHARD ABRAHAM Avatar answered Sep 22 '22 21:09

RICHARD ABRAHAM