Prototype hide 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 the prototype library. I need to hide a div that has a http://google.com link with it. Thanks.
+1
a source to share
3 answers
Is jQuery available ?
If so, use the following code:
$(document).ready(function() {
$('a[href=http://www.google.com]').parent('div').hide();
});
If the parent is not necessarily the closest next level in the DOM, use .parents
instead:
$(document).ready(function() {
$('a[href=http://www.google.com]').parents('div').hide();
});
However, this can affect at div
an even higher level in the tree.
0
a source to share