Hi Chaim,

Chaim schrieb:
> If the link in "matchThis" has the same href as the link in 
> "navigation," how can I select the link with the matching href in 
> "navigation? "
>
> for the code:
> <div id="navigation">
> <a href="about.html">I want this link, because the href matches</a>
> <a href="bla.html">I don't want this Link</a>
> <a href="gla.html">I don't want this Link</a>
> <a href="zla.html">I don't want this Link</a>
> </div>
> <div id="matchThis"><a href="about.html">Link to match to</a></div>
>
>   
Try this (untested):

var HREF_to_match = $('#matchThis').find('a').eq(0).attr('href');
var $matched_links = $('#navigation').find('a[href=' + HREF_to_match + ']');
alert('I was found in ID navigation, this is my href-attribute: '  + 
$matched_links[0].href + '. This href should be the same as the 
following: ' + HREF_to_match);

Good luck,

-- Marc

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to