i'm trying to add some navigation arrows which allow the user to go to the next/prev link in a list.
I'm having trouble getting jQuery to fire the click event on the next link when the arrow is clicked.
I've set up a test using addClass() and I can see that jQuery is referencing the right link because it adds the class to it, it's just not triggering the click event on it.
HTML:
<ul class="menu">
<li class="active">
<a href="#thelink#">Link text</a>
</li>
<li>
<a href="#thelink2#">Link text 2</a>
</li>
<li><a class="next-page" href='#'>></a><li>
</ul>
jQuery:
$jQ(".menu a.next-page").click(function() {
$jQ('.menu li.active').next().find('a').addClass('test');
$jQ('.menu li.active').next().find('a').click();
});
Using this code, when I click on the next arrow it adds the class 'test' to the link in the second list item, but the link is not clicked.
as is often heavily restricted by browsers' security settings. The syntax seems ok (apart from the weird$jQ, but it seems to be working).