search - jQuery find similar attributes -
search - jQuery find similar attributes -
my page has 2 'tabbed' navigation sections. both independent of one-another, resulting in same outcome. figure easiest way go coding them work together, find `href' attribute same both sections, save in variable, , go on there.
my layout looks this.
<div id="tab-text"> <a href="tab-1"></a> <a href="tab-2"></a> <a href="tab-3"></a> </div> <div id="tab-arrow"> <a href="tab-1"></a> <a href="tab-2"></a> <a href="tab-3"></a> </div>
and have jquery this.
jquery('#tab-text a').click(function() { jquery('#tab-text a').removeclass('active'); jquery( ).addclass('active'); }
so how can include in jquery if #tab-text a
clicked, find value of href
attribute, , search value #tab-arrow a
, .addclass()
jquery('#tab-text a').click(function() { jquery('#tab-text a').removeclass('active'); jquery( ).addclass('active'); var searchhref = this.href; jquery('#tab-arrow a[href="'+searchhref+'"]').dosomething(); }
jquery search attributes href
Comments
Post a Comment