Reputation: 9910
I need to decieve an HTML element into thinking my cursor id hovering over it.
Can anyone tell me how I might accomplish this? I know I can to something like this $(this).click()
to simulate a mouse click. I need an equivalent for hovering.
Thanks
Upvotes: 1
Views: 2594
Reputation: 5628
You can use $(el).trigger('mouseover') but that will only execute any hover callbacks you've set up. It won't trigger the browser's hover detection such as for applying css hover rules.
$(function() {
$('#s').hover(function() { alert('Wee'); });
$('#b').click(function() { $('#s').trigger('mouseover'); });
});
Upvotes: 1