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

Vic Mercier
Vic Mercier
3,276 Points

Why do we need to use *?

I'm confusing.What would it do without *?

$('a').not('[href*="my-domain.com"]').attr("target", "_blank");
Steven Parker
Steven Parker
231,269 Points

Are you asking about an asterisk symbol ("*")? I don't see one in that line of code, perhaps it's being lost because the code is not formatted.

Always use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or watch this video on code formatting.

1 Answer

Steven Parker
Steven Parker
231,269 Points

I'm going to guess that you intended to show "*=" in the attribute selector. That symbol means "contains", so it would match any value that contained the string shown. But just a plain "=" symbol means "equals", and would only match if the value was exactly the same as the string shown.