开发者

Selecting a link with jQuery

I want to be able to search for a substring inside the href's in the b开发者_Python百科elow code and select the link AFTER the selected string. So, for example the string "page=2" would access the third link.

Thanks in advance.

<div id="container">
<a href='test.php?page=1&title=a title'><a title</a>
<a href='test.php?page=2&title=another title'><another title</a>
<a href='test.php?page=3&title=a last title'><a last title</a>
</div>


jQuery("a[href*='page=2']").next("a"); try this


You can do like:

$("a[href*='page2']").next("a");

Or simply:

$("a[href*='page2']").next();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜