Re: How to turn autocomplete off

David Dorward wrote:

> M. Verbakel wrote:
>> I made a small form, but when i try to fill it in, i can't click on
>> the next field!
>> How can I, XHTML 1.0 Transitional valid, turn it autocomplete off?
>
> This mailing list is not the best place for HTML authoring questions.

Well, this is for validator-related questions. The question belongs to that 
category, broadly speaking, but its prelude is mysterious. However, let's 
skip it, as it does not look validator-related at all.

> That said, the short answer is: "You can't".

It depends. I would say that the following does the job on IE, and for other 
browsers, it's probably not possible anyway.

...
<body onload="init()">
...
<form ...>
...
<input id="foo" ...>
...
</form>
<script type="text/javascript">
function init() {
document.getElementById("foo").autocomplete = "off";
</script>

Of course this means turning autocomplete off outside HTML, namely in 
JavaScript, but in a manner that formally complies with HTML DTDs. Even 
XHTML 1.0 Transitional, should anyone want to use that oddity.

Why bother? Don't ask me. I just answered the question as it was posed.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Friday, 17 July 2009 21:30:17 UTC