jQuery mouseup() Method

jQuery mouseup() event occurs when a mouse left button is released over the selected element. The jQuery mouseup method triggers the mouseup event, and when the event occurs specified function will execute.

This method is usually used together with the mousedown() method.

Syntax

This syntax represent to the mouseup() method

$(selector).mouseup();        // This syntax does not accept any arguments.

and this syntax represent to attach a function to the mouseup event

$(selector).mouseup(function);
Parameter Type Description
function Function Optional. Specifies the function to execute when the mouseup is occurs

Examples

This example represent the mouseup event

$(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();
  });
});

Run it...   »


This example represent to attach a function to the mouseup event.

$(document).ready(function(){
  $("input").mousedown(function(){
    $("input").css("background-color", "yellow");
  });
  $("input").mouseup(function(){
    $("input").css("background-color", "pink");
  });
});

Run it...   »