I have this
...
<li style="padding: 50px;">
<a href="blabla" style="background:red;">Click Me</a>
</li>
...
As you all may know that the <a> tag will be smaller in size.
I want to use jquery as so…
$('li').click(function (){
$(this).find('a').trigger('click');//does not work :(
alert($(this).find('a').attr('href'););//returns blabla//which is correct
});
Any ideas why the <a> cannot be triggered in this way ?
PS
jQuery’s
triggerfunction will call event handlers registered using jQuery.It will not simulate a real click.
Instead, you can write