开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜