jQuery mousedown () method
Examples
On the <div> element pressing the left mouse button, insert some text:
$("div").mousedown(function(){
$(this).after("Mouse button pressed down.");
});
$(this).after("Mouse button pressed down.");
});
try it"
Definition and Usage
When the mouse pointer moves over the element and pressing the left mouse button, mousedown event occurs.
mousedown () method triggers the mousedown event or add a function to run when the event mousedown event.
Tip: This method is usually mouseup () used with the method.
grammar
Trigger the selected element mousedown events:
$(selector).mousedown()
尝试一下
Add the function to the mousedown event:
$(selector).mousedown(function)
尝试一下
参数 | 描述 |
---|---|
function | 可选。规定 mousedown 事件触发时运行的函数。 |