Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually trigger mouseover event without allowing the event to propagate

How can I trigger mouseover event using jQuery just for a specific element, without allowing the event to propagate to the parent controls.

I know how to trigger the event: $('selector').trigger('mouseover');

For example I have an image inside tr. I have hover event handlers for both of them. I want to manually trigger hover-in event just for the image.

Does anyone have an idea?

like image 726
Vladislav Avatar asked Sep 19 '25 06:09

Vladislav


1 Answers

I found the answer looking in the examples here. Here is the code solving my problem:

var event = jQuery.Event('<event_name>');
event.stopPropagation();
$('<selector>').trigger(event);
like image 73
Vladislav Avatar answered Sep 22 '25 02:09

Vladislav