Reputation: 1136
I know if you move mouse, that event will invoke however how can I invoke that event just with help of the code?
Upvotes: 2
Views: 268
Reputation: 962
If you have a jQuery element from which you want to fire an event you need the trigger method
var $t = jQuery('#idToElement');
$t.trigger('mousemove',['parameter1','parameter2']);
If you want to do this with pure javascript you need the createEvent function of the document object. You can find more about that here
Upvotes: 1
Reputation: 206669
AFAIK you cannot move the user's mouse pointer if that was the question.
It would be called "mousejacking" ;)
Not sure why you ask, but,
if your goal is to simulate a click on another element you could do:
$('#element_1').click(function(){
$('#element_2').click();
});
Upvotes: 1