How to select all links whose protocol is not http with jQuery?
Suppose that you have:
<a href="file://...">link1</a>
<a href="file://...">link2</a>
<a href="http://...">link3</a>
<a href="http://...">link4</a>
What code should I use to select only 开发者_如何学编程link1 and link2 without using a[href^=http]
?
That's exactly how you would do it:
$('a:not(a[href^=http])')
or
$('a[href^=file]')
What's wrong with selecting based on the href attribute?
精彩评论