This question already has an answer here:
I have written a javascript statement:
var n=document.getElementById("image");
this code doesn't work. But when I change id to class and the statement:
var n=document.getElementsByClassName("image");
it works perfectly fine. Can anyone explain why can't I do the same with id..
Thanks in Advance
NOTE: When I say work I mean variable 'n' has some value stored.
PS: To all those guys who wish to thumbs down this question..I request you to explain the reason before doing so...chill
via Buetman
No comments:
Post a Comment