views:

444

answers:

1

I need a pattern that will traverse the document and get me all links that have mailto in their href:

<a href="mailto:[email protected]">text</a>

I could of course easily get all a elements ($("a")) and check each href attribute to see if it points to a mailto but I think that jQuery has some form of pattern matching that will allow me to do just that.

What is the best way to achieve that?

+7  A: 

$('a[href^=mailto:]')

David Hedlund
+1 Exactly what I was looking for
Andreas Grech