Here's the code snippet I'm working on:
<body class="asdf">
<span>hey! <div class='hideContent'>test</div> the ultimate experience</span>
<span id="blarg">original</span>
</body>
<script>
function pullElementsOut(searchClass, searchNode) {
var childNodes = (searchNode || document.body).childNodes, cnLength = childNodes.length;
var excludes = 'html,head,style,title,link,meta,script,object,iframe';
while (cnLength--) {
var currentNode = childNodes[cnLength];
alert(currentNode.nodeType+" "+currentNode.localName + " " + currentNode.hasAttributes());
if (currentNode.nodeType === 1 && (excludes + ',').indexOf(currentNode.nodeName.toLowerCase() + ',') === -1) {
arguments.callee(searchClass, currentNode);
}
if (currentNode.nodeType !== 2) {
continue;
}
}
}
pullElementsOut('hideContent');
</script>
I'm stuck on the unfinished pullElementsOut function. My goal is to locate elements with the "hideContent" class and remove them, but I'm struggling to access and modify node attributes. Any suggestions or guidance would be appreciated.
Can anyone assist?