javascript - document.getElementById doesnt work with "input id", how can I do it? [+Greasemonkey] -


i have line on website

<input type="text" autocomplete="off" value="" maxlength="20" class="shipbox" name="firstname" id="firstname"> 

and want greasemonkey automatically fill this...

i'm trying had no success

document.getelementbyid("firstname").setattribute("autocomplete", "on"); document.getelementbyid("firstname").value = "bruno" 

what you're doing correct way.

the usual reaqson not working second element same id somewhere in document.

by way, setattribute not recommended way of setting attribute in html, i've been reminded today. simple ...getelementbyid("firstname").autocomplete = 'on' do.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -