Latest web development tutorials

jQuery mouseenter () method

jQuery Event Methods jQuery Event Methods

Examples

When the mouse pointer enters the <p> element, set the background color to yellow:

$("p").mouseenter(function(){
$("p").css("background-color","yellow");
});

try it"

Definition and Usage

When the mouse pointer across the (enter) when the selected elements, mouseenter event occurs.

mouseenter () method triggers mouseenter event or add a function to run when the event occurs mouseenter.

Note: the mouseover event different, mouseenter event only when the mouse pointer enters the selected element is triggered, mouseover event will be triggered when the mouse pointer enters any of its child elements.See the bottom of the page presentation instance.

Note: This event is usually associated with mouseleave use incident.


grammar

Trigger the selected element mouseenter events:

$(selector).mouseenter() 尝试一下

Adding Functions to mouseenter event:

$(selector).mouseenter(function) 尝试一下

参数 描述
function 可选。规定 mouseenter 事件触发时运行的函数。


Examples

More examples

Different mouseenter () and mouseover () between
Different Demo mouseenter () and mouseover () between.


jQuery Event Methods jQuery Event Methods