views:

233

answers:

2

So the autocomplete="off" attribute is invalid HTML according to the w3c. Are there valid ways to do this in HTML, CSS or JavaScript? Or do we just have to plan on some of our forms not validating because we want to use this functionality.

+2  A: 

autocomplete is valid HTML5 and is supported by all major browsers. What more do you want?

mercator
HTML5 is still only proposed, so technically we still fail validation. But thanks for the heads up on HTML5 now including it. And as for the major browsers, Opera doesn't support it.
icco
A standard that isn't marked "Draft"
David Dorward
+1  A: 

Use javascript:
element.setAttribute("autocomplete","off");

Tim Jansson
This is nothing but a hacky work-around to please the validator, since it comes down to exactly the same thing in the DOM.
mercator