How can I use trigger() to trigger the click event on a particular link only?
for instance, I have this menu,
<li><a href="#" class="load-popup-public 500x400">1</a></li>
<li><a href="#" class="load-popup-public 500x400">2</a></li>
<li><a href="#" class="load-popup-public 500x400">3</a></li>
<li><a href="#" class="load-popup-public 500x400">4</a></li>
and I want to trigger the first link only when the page is loaded. so that I can call this function automatically when the page is loaded,
$('.load-popup-public').click(function (){
...
});
You can use
:firstselector to select the first link and then use documentreadyevent.Try this:
Working example: http://jsfiddle.net/zeyWN/