10

In jQuery, is it possible for an element to act like it is mouseovered automatically when the page is loading, when it is not really mouseovered? I mean, I won't put my pointer on the desired element for it to do what it would do if I put.

0

3 Answers 3

22

Use .trigger() to trigger an event.

$('#foo').trigger('mouseover');
0
8

You can call the handler directly

$('abc').mouseover();
0
2

Put the desired action in the document.ready function as that is when you actually want the action, not on a mouse-over that doesn't happen.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.