Disable forms autocomplete

0

Hello ... I have a problem that I thought was simple, but I've been looking for a solution for two days ...

I just can not get forms autocomplete off. I remembered the autocomplete="off" for this, but it does not work anymore.

Does anyone have an alternative to doing this on the site? (no matter the language, the HTML will be the same after all).

PS: For Chrome, the code below does the work:

        $("input[autocomplete='off']").each(function () {

            var input = $(this);
            var id = $(this).attr("id");
            var name = $(this).attr("name");

            input.removeAttr("name").removeAttr("id");

            setTimeout(function () {
                input.attr("name", name).attr("id", id);
            }, 1);

        });

Thank you.

    
asked by anonymous 19.05.2017 / 20:06

2 answers

0

autocomplete="off" still works, but you can also try with jQuery.

$( document ).on( 'focus', ':input', function(){
        $( this ).attr( 'autocomplete', 'off' );
    });
    
19.05.2017 / 20:12
0

According to the W3school , this is a standard behavior, and should, yes, be working.

<form action="/action_page.php" autocomplete="on"> <!-- este está habilitado -->
First name:<input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
E-mail: <input type="email" name="email" autocomplete="off"><!-- Já este não --><br>
<input type="submit">
</form>

Try to check the tags, many may be the risks that can cause this.

    
20.04.2018 / 19:48