I have two sets of elements with (sometimes) corresponding rel and id attributes:
<a rel="1" style="display:none"/>
<a rel="2" style="display:none"/>
<a rel="3" style="display:none"/>
and
<p id="1"/>
<p id="3"/>
<p id="chocolate"/>
I want an <a>
element to appear when a <p>
with a matching ID is loaded via a .get()
request.
I figured I'd use filter(), but can't get it to work. I tried
$('a').filter(function() {
return $(this).attr('rel') == $('p').attr('id');
}).show();
This seems to work on the the first element, but my understanding of filter() is that it should go through the whole list. Thanks.