Using jQuery to target a specific link in the navigation
I am working with a dynamic navigation and need to be able to target one specific link to open in a new window.
I need some help开发者_StackOverflow with the jQuery to do this.
For example I would like to be able to target the navigation item of Education which has a link of http://www.foo.com/education and have it open in new window when I click on it.
Would appreciate some assistance.
Thanks.
try:
$("a[href='http://www.foo.com/education']").attr('target', '_blank');
window.open( $("a[href='example.com']").attr('href') );
or just
<a href="http://www.food.com/education" class="education" target="_blank">Education</a>
don't know why you would need to do this with jQuery.
精彩评论