开发者

how do i set value of a textbox using javascript

开发者 https://www.devze.com 2023-02-01 15:25 出处:网络
I am trying to get a value fro query string and assign that value into a textbox. I am able to get the value from query string but unable to assign it to textbox.

I am trying to get a value fro query string and assign that value into a textbox. I am able to get the value from query string but unable to assign it to textbox.

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

Tried the above code but doesn't seem to be working. Though the alert of email 开发者_Python百科gives the right value.


You need a lower-case value and a plural Elements:

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

You need the [0] to get the first element in the list. Names don't have to be unique like ids.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号