How to call a function after the user drops the mouse click?

Asked

Viewed 650 times

2

On a page there is an element that the user can drag with the mouse, would like to call a function after the user drop this element (when dropping the mouse click). How to do this without having the element as a reference, just recognizing that the mouse button is no longer pressed?

1 answer

2


mouseup()

The event is triggered when the mouse button is released. Note that the message is only displayed when the mouse button (any one) is released.

Example of mouseup usage

$(function(){
    $("#div1").mouseup(function(){
        alert("O botao foi solto.")
    });
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.