Skip to content

Instantly share code, notes, and snippets.

@JonathonReinhart
Created July 19, 2022 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathonReinhart/d33e460f08febd08af3a0ede7fd389d7 to your computer and use it in GitHub Desktop.
Save JonathonReinhart/d33e460f08febd08af3a0ede7fd389d7 to your computer and use it in GitHub Desktop.
Mouse click log
<!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>
@JonathonReinhart
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment