Jump to content
Sign in to follow this  
Raj_100

document.getElementById(id) getting null value!1

Recommended Posts

Hi

 

in my js var tl = document.getElementById(id); getting null value

 

can anyone give suggestion on this.......

 

 

Thanks in a Advance

 

Regards

Raj Kumar R

 

 

 

 

Share this post


Link to post
Share on other sites

Maybe your javascript code is running before your document html has loaded.

 

Try wrapping your javascript initial code into an onload event:

 

 

window.addEventListener('load', function() {    var tl = document.getElementById('id');    alert(tl);});

Share this post


Link to post
Share on other sites

don't u need quotes for ur id inside bracket?????

 

like

tl = document.getElementById('id');
Edited by funbinod

Share this post


Link to post
Share on other sites

Is id supposed to be a string or a variable name? You didn't show any code defining any "var id", so I'm assuming that you forgot quotes in your code

Edited by Hadien

Share this post


Link to post
Share on other sites

Thanks for your reply frds. now issue got resolved.

 

fix is my application does not support struts html tag and i tried with noraml html tag and now vaalue is gettting and issue got resolved.

 

 

once agin thanks .

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...