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 trialBhaskar Singh
8,532 Pointswhy 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');
1 Answer
Sam Donald
36,305 PointsThe *
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.
Bhaskar Singh
8,532 PointsThanks
nico dev
20,364 Pointsnico dev
20,364 PointsJust 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. :)
HTH.