Search code examples
selecthtmlprototypejshref

Prototype hide the div that has a specific link (<a href)


I have the following HTML:

<div> <a href="http://google.com"> Google </a></div>

I am using prototype library. I need to hide the div that has the link http://google.com with it. Thank you.


Solution

  • In Prototype:

    $$('div a[href="http://google.com"]').each(function (e) { Element.hide(e.parentNode); })