jquery force click (href)

agis picture agis · Apr 30, 2011 · Viewed 42.3k times · Source

I have this:

<li>
 <a href="#" data-content="visit">
  <span class="bf_hover"></span>
  <span>Visit us</span>
 </a>
</li>

And I want to automatically open the "Visit Us" link.

How I can do this ?

Answer

Hussein picture Hussein · Apr 30, 2011

You can trigger a click by doing

$('li a').trigger('click');