Raj_100 Posted September 9, 2014 Share Posted September 9, 2014 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 Link to comment Share on other sites More sharing options...
JamesB Posted September 9, 2014 Share Posted September 9, 2014 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);}); Link to comment Share on other sites More sharing options...
srinivas g Posted September 9, 2014 Share Posted September 9, 2014 As per the code u r missing to write "value" after ur code i mean write var tl = document.getElementById(id).value; instead of var tl = document.getElementById(id); Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2014 Share Posted September 9, 2014 Do not ask the same question in 3 different topics. Link to comment Share on other sites More sharing options...
funbinod Posted September 10, 2014 Share Posted September 10, 2014 (edited) don't u need quotes for ur id inside bracket????? like tl = document.getElementById('id'); Edited September 10, 2014 by funbinod Link to comment Share on other sites More sharing options...
Hadien Posted September 10, 2014 Share Posted September 10, 2014 (edited) 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 September 10, 2014 by Hadien Link to comment Share on other sites More sharing options...
Raj_100 Posted September 10, 2014 Author Share Posted September 10, 2014 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 . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now