Created
July 19, 2022 13:39
-
-
Save JonathonReinhart/d33e460f08febd08af3a0ede7fd389d7 to your computer and use it in GitHub Desktop.
Mouse click log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>mousedown demo</title> | |
<script src="https://code.jquery.com/jquery-1.10.2.js"></script> | |
</head> | |
<body> | |
<div id="trigger" style="border-style: solid">Click here to log.</div> | |
<div id="clear" style="border-style: solid">Click here to clear.</div> | |
<div id="log"> | |
</div> | |
<script> | |
$("#trigger") | |
.mouseup(function() { | |
var now = new Date(); | |
$("#log").append( "<p style='color:#f00;'>" + now.getSeconds() + "." + now.getMilliseconds() + " Mouse up.</p>" ); | |
}) | |
.mousedown(function() { | |
var now = new Date(); | |
$("#log").append( "<p style='color:#00f;'>" + now.getSeconds() + "." + now.getMilliseconds() + " Mouse down.</p>" ); | |
}); | |
$("#clear") | |
.mousedown(function() { | |
$("#log").empty(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modified from https://api.jquery.com/mousedown/