Javascript is the wrong way to do this, but I will give you the answer to this question:
var links = document.getElementsByTagName('a'), link, children; for(var i = 0; i < links.length; i++) { link = links[i]; if(link.href == window.location.href) { children = link.childNodes; for(var j = 0; j < children.length; j++) { link.parentNode.insertBefore(children[j], link); } link.parentNode.removeChild(link); } }
Edit: I don't know if the “he-two-hockey-sticks” is a “dirty language” on SO, but if so, it will be mysteriously removed after a few months, so I used “heck” instead.
source share