.mousemove()

In this chapter you will learn:

  1. Syntax and Description for .mousemove() event

Syntax and Description

.mousemove(handler)            
.mousemove()

handler is a function to execute each time the event is triggered. Return value is the jQuery object, for chaining purposes.

mousemove binds an event handler to the mousemove event, or trigger that event on an element.

.mousemove(handler) is a shortcut for .bind('mousemove', handler). .mousemove() is a shortcut for .trigger('mousemove').

For example:

<div id="target">Move here</div>
<div id="other">Other</div>

The event handler can be bound to the target:

$('#target').mousemove(function(event) {
   $.print(event.pageX + ', ' + event.pageY);
});

We can also trigger the event when the second button is clicked.

$('#other').click(function() {

 $('#target').mousemove();

});

Next chapter...

What you will learn in the next chapter:

  1. Syntax and Description for .mouseover() event
  2. How to listen to mouse over event
  3. How to change style for mouse over event
Home » jQuery » Event
Event
Event attributes
event.keycode
event.clientX/clientY
pageX/pageY
Cancel event
Event target
bind
.blur()
.change()
.click()
.error()
.dblclick()
.delegate()
.die()
.focus()
.hover()
.keydown()
.keypress()
.keyup()
.live()
.load()
.mousedown()
.mouseenter()
.mouseleave()
.mousemove()
.mouseover()
.mouseout()
.mouseup()
.off()
.on()
.one()
.ready()
.resize()
.scroll()
.select()
.submit()
.toggle()
.trigger()
.triggerHandler()
.unbind()
.undelegate()
.unload()