You can do something like this:
$('a[href^="http://domain.com/"][href$="#foo"]');
This selects a elements having href , which starts with http://domain.com/ and ends with #foo .
If you don't care about the foo part and only care about the hash, use this instead:
$('a[href^="http://domain.com/"][href*="#"]');
The second part of the selection is the βcontainsβ filter.
Jason p
source share