jQuery Tutorial


jQuery Example


jQuery References


jQuery mousedown() Event Reference


  jQuery Events References


Uses

jQuery mousedown() Event Occurs when mouse button is pressed.


Bind a Function to mousedown() event

Defined function run when the mousedown() event occurs on the selected elements.

Syntax

$(selector).mousedown(function) 

jQuery mousedown() events supported following parameters.

ParameterDescription
functionFunction is Optional parameter. Function define the ready to run when event occur.

Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("input").mousedown(function(){
    $("input").css("background-color","#FFFF99");
  });
  $("input").mouseup(function(){
    $("input").css("background-color","pink");
  });
});
</script>
Online Try This Code Your Self....   »

Trigger the mousedown() event

Triggering the mousedown() event for a selected elements.

Syntax

$(selector).mousedown()

Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("input").mousedown(function(){
    $("input").css("background-color","#FFFF99");
  });
  $("input").mouseup(function(){
    $("input").css("background-color","pink");
  });
  $("#btn1").click(function(){
    $("input").mousedown();
  });  
  $("#btn2").click(function(){
    $("input").mouseup();
  });  
});
</script>
Online Try This Code Your Self....   »

  jQuery Events References