Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introduction to jQuery Hello, jQuery! Accessing and Modifying Attributes

Bhaskar Singh
Bhaskar Singh
8,532 Points

why there is * in the href attribute in jQuery

why there is * in the href attribute in $('a').not('[href*= "my-domain.com"]').attr('target','_blank');

nico dev
nico dev
20,364 Points

Just like Sam Donald said.

Just wanted to add that, since jQuery mostly use CSS selectors, this course (and most particularly its last section, advanced selectors) could be very a helpful tool to understand this kind of selectors better. Maybe you want to branch out there a little. :)


1 Answer

Sam Donald
Sam Donald
36,305 Points

The * selector selects everything.

So here it's been used to select every link that does not contain the string my-domain.com anywhere in its href attribute.