How to set textbox value using javascript

I am trying to get the value of a query string and assign that value to a text box. I can get the value from the query string, but I can not assign it to the text box.

document.getElementByName('Contact0Email').Value = email;

Tried the above code but doesn't seem to work. Although an email alert gives the correct meaning.

+5
source share
1 answer

You need lowercase valueand plural Elements:

document.getElementsByName('Contact0Email')[0].value = email;

You need [0]to get the first item in the list. Names do not have to be unique, such as identifiers.

+22
source

All Articles