Hi, I'm just getting into the world of Javascript and is faced with this following problem: How to filter out and hide/remove only those <p> elements that I've given a certain className with unobtrusive javascript. Is there anyone out there that can display an example of how this is done?? Please - I would be eternally greatful!!
Hi, document.getElementsByTagName('p') gives you array of all <p> elements in current document. So you go through the array and search for className=='some_class' var p_tag=document.getElementsByTagName('p'); for(var i=0, l=p_tag.length; i<l; i++) { if(p_tag.className=='some_class') do something...(below) } p_tag.parentNode.removeChild(p_tag) => remove p_tag.style.visibility='hidden' => hide Does it help? Enjoy JS