When i am trying to write the code like
document.getElementById(‘id1’) after teh script tag it is showing document.getElementById(..) null or not an object..
Is it necessary to write document.getElementById(‘id1’) in function only.
If i write this code in function then it is accepting. So what the mistake here..
and if i want to execute a function on loading of the page where to write onLoad() function.. i try to write at but it is not loading.. please help me
Thank you
When i am trying to write the code like document.getElementById(‘id1’) after teh script tag
Share
In order to be sure that your dom element is loaded, you have to wait the document is loaded.
To do this you can do:
or