How to attach mouse down event to an element in jquery ?

 Posted by Vivek.Ramapuram on 11/7/2014 | Category: jQuery Interview questions | Views: 827 | Points: 40
Answer:

mousedown() method can be used for mouse down event to a html element,.
Example :
<script type="text/javascript">


$("#spanMouseDownUp").mousedown(function () {
$(this).html("Mouse down");
});
</script>
<div id="spanMouseDownUp" style="background:green;
color:White;padding:10px;">Try to click here</div>


In mouse event method () when user start clicking mouse on the “spanMouserDownUp” element “Mouser clicked” will be written inside it.


Asked In: spotted while learning | Alert Moderator 

Comments or Responses

Login to post response