recently i came across a problem with getElementById. I used this function in the master page in side a JavaScript but it returned an error. I don't know why it happened and still finding the cause. however i used a alternative method to archive this task.
var item = window.document.getElementsByName("tagName")[0];
This worked for me.
Comments
I would try to use it in the following way
window.document.getElementByName("txtName").value;
Thanks
Hi,
[0] getting the first element of the array. because getElementByName("txtName") returns array not a single element