$('myselector').hover(function(){ $(this).trigger('click'); });
EDIT: later than the message, but just to illustrate how to add a handler and run it.
$('myselector').on('click',function(){ // handle click event, put money in my bank account }).on('mouseenter',function(){ $(this).trigger('click'); // only on enter here // handle hover mouse enter of hover event, put money in my bank account }).on('mouseleave',function(){ // handle mouse leave event of hover, put money in my bank account }).trigger('click');
Just need it once?
$('myselector').on('click',function(){ // handle click event, put money in my bank account }).one('mouseenter',function(){ $(this).trigger('click'); // only on enter here once // handle hover mouse enter of hover event, put money in my bank account }).on('mouseenter',function(){ // handle hover mouse enter of hover event, put money in my bank account }).on('mouseleave',function(){ // handle mouse leave event of hover, put money in my bank account });
Mark schultheiss
source share