I have a link:
<ul id="titleee" class="gallery">
<li>
<a href="#inline" rel="prettyPhoto">Talent</a>
</li>
</ul>
and I am trying to trigger it by using:
$(document).ready(function() {
$('#titleee').find('a').trigger('click');
});
But it doesn't work.
I've also tried: $('#titleee a').trigger('click');
Edit:
I actually need to trigger whatever get's called here <a href="#inline" rel="prettyPhoto">
Sorry, but the event handler is really not needed. What you do need is another element within the tag to click on.
Jquery:
This is all about what you are clicking and it is not the tag but the thing within it. Unfortunately, bare text does not seem to be recognised by JQuery, but it is by vanilla javascript:
Or by accessing the jQuery object as an array
This doesn't exactly answer your question, but will get you the same result with less headache.
I always have my click events call methods that contain all the logic I would like to execute. So that I can just call the method directly if I want to perform the action without an actual click.
If you are trying to trigger an event on the anchor, then the code you have will work.
OR
OR