if button click javascript code example
Example 1: detect button click jquery
$(".btn").click(function(){
var clk = $(this).attr("id");
});
Example 2: if mousepressed javascript
var mouseDown = 0;
document.body.onmousedown = function() {
++mouseDown;
}
document.body.onmouseup = function() {
--mouseDown;
}