How to trigger mouseover function on an element when not really mouseovered
问题 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. 回答1: Use .trigger() to trigger an event. $('#foo').trigger('mouseover'); 回答2: You can call the handler directly $('abc').mouseover(); 回答3: Put the desired action in the document.ready function as that is when you actually want the action, not on a mouse