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();
精彩评论