<!DOCTYPE html>
<html>
<head>
<title>jQuery mousedown() and mouseup() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$("input").mousedown(function(){
$("input").css("background-color", "yellow");
});
$("input").mouseup(function(){
$("input").css("background-color", "pink");
});
$("#btn1").click(function(){
$("input").mousedown();
});
$("#btn2").click(function(){
$("input").mouseup();
});
});
</script>
</head>
<body>
<button id="btn1">Trigger MouseDown</button>
<button id="btn2">Trigger MouseUp</button>
<br /><br />
Name: <input type="text" name="name" />
</body>
</html>