Reputation:
Html:
<ul class="productList">
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
</ul>
jQuery:
$('.productList').click(function(e){
var li = $(e.target);
//bla bla bla
});
The problem is, from some other place, i want trigger the above event and when triggering i want to pass the a specific li
as event target
to that function. Simply, i want to modify the event
object and set some li
as target in that object. Is there any way to do it in jquery?
I'm aware of binding the click
directly to the li
in which case i will be able to avoid this problem. But its a huge list, it makes the app very slow.
Any suggestions would be appreciative!!
Thanks
Upvotes: 0
Views: 88
Reputation: 816790
Just pass the li
element to jQuery
and trigger the event:
$(referenceToLi).click();
Upvotes: 4