phpheini
phpheini

Reputation: 429

Is there an alternative to the autocomplete="off" attribute that’s valid XHTML Strict?

I have an XHTML 1.0 Strict document with an input field with autocomplete='off'. The w3c validator tells me that in strict documents you may not use autocomplete. So is there an alternative without changing the document type?

Upvotes: 2

Views: 3939

Answers (5)

dGame
dGame

Reputation: 1

The correct solution in this latest version is put on the input autocomplete = 'false'.

Upvotes: 0

gus
gus

Reputation: 61

How about putting a hidden and fake password field like

<input type="password" name="stupid_autofill" id="stupid_autofill" value="" style="display:none;">

before the real password field. This generally works on the basis of the browser trying to guess the input field before the password field.

Upvotes: 0

Rohit Suthar
Rohit Suthar

Reputation: 3628

You can solve this issue simply by using jquery

//Try this one:

    $(document).ready(function(){
    $("input.autocompleteOff").attr("autocomplete","off");
    });

//For all textbox -

    $(document).ready(function(){$("input").attr("autocomplete","off");});

//HTML

<input type="text" name="field" id="field" class="autocompleteOff" />

Upvotes: 0

Senya
Senya

Reputation: 1

You can use javascript. Write a little function that clears all of the input fields in a form by settings there value to an empty string. On page load, call the function, but call it in a setTimeout of about a second or so. If a value has been automatically entered into a field by the browser, it will be wiped by the javascript. The only problem with this is that the autocomplete value may be temporarily visible in the field before it is replaced.

Upvotes: 0

Quentin
Quentin

Reputation: 944205

No. XHTML 1.0 provides no means to tell browsers not to help users fill in form fields.

Upvotes: 2

Related Questions