javascript - I am not able to hide my p tags in javasctript -
i don't know having error when run script says undefined in firebug.not telling me undefined.here javascript.
var elements = document.getelementsbyname("p"); var length = elements.length; (var = 0; < length; i++) { elements[i].style.display='none'; }
i think want getelementsbytagname
:
var elements = document.getelementsbytagname("p"); var length = elements.length; (var = 0; < length; i++) { elements[i].style.display='none'; }
document.getelementsbyname("p");
returns elements have name
attribute of p
such as:
<span name="p"></span>
Comments
Post a Comment