Forum Moderators: open

Message Too Old, No Replies

Update input via name value instead of it's ID?

         

JAB Creations

11:49 am on May 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have about a dozen input elements that I'd like to update the values of, the catch is I want to use JavaScript to select them via the value of their name attribute. I'd like to avoid having to add id attribute/associated values as the values would be the exact same for the name attribute's value. Here are a couple things I've attempted (with the possibility of nodes thrown in my head while I was searching...

- John

document.getElementsByTagName('ce02').value='004';

document.getElementsByTagName('ce02')[0].value='004';

mehh

3:06 pm on May 6, 2008 (gmt 0)

10+ Year Member



try
document.getElementsByName('ce02')[0].value='004';