When developing an html form, there are many occassions where you might want to disable Mozilla’s or Internet Explorer’s auto-complete feature. This may be for credit card payment or login forms. Whatever your case may be, the following code will disable autocomplete in a form element.
<input type="text" name="login" value="" autocomplete="off" />
This code will not validate in XHTML, but is one of those cases where security is more important than validation. Another way you could do this so validation is successful would be to use JavaScript.
document.forms[0].elements['login'].setAttribute("autocomplete", "off");
As you can see, by using DOM you effectively hide the attribute that does not validate.