Can I use CSS to override the disabling of autocomplete for a form, if so, how?

410 views Asked by At

I am trying to use the chrome extension Stylish to reenable autocomplete on forms that have it disabled.

Specifically, the form has it disabled by specifying autocomplete="off" and I want it re-enabled.

I tried using this:

form { autocomplete: on;}

and variations of it, but it does not work. I'm not sure if this is even an attribute you can override via CSS, let alone how to do it.

3

There are 3 answers

1
AKX On

You could write an userscript to do that.

3
Itay Moav -Malimovka On

CSS affects what's inside style properties, and some of the old attributes (length/cellpadding/color etc). autocomplete is not one of those. JS is the right way.
Something on the lines of:

documnet.getElementById('element_id').autocomplete='on';
0
Trampas Kirk On

I installed Firebug, and used it to figure out the syntax, then wrote a crude script for Tampermonkey (Yes, those are for different browsers. I wanted this to work in Chrome, but knew firebug would be a quick way to figure out and test the syntax.):

// ==UserScript==
// @name       Autocomplete Enabler
// @version    0.1
// @description  enter something useful
// @include    http://*/*
// @include    https://*/*
// @copyright  2011+, You
// ==/UserScript==
var formcount=0;
var i=0;

for (i=0;i<=formcount;i++)
{
    document.getElementsByTagName('form')[i].setAttribute('autocomplete','on');
}

It worked, at least for my bank's website. I'll save form information if I want to!