Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Event Object (e)</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style>#box{width:150px;height:80px;border:1px solid #ccc;background:#f9f9f9;}</style> </head> <body> <div id="box">Click me</div> <pre id="out"></pre> <script> $("#box").on("click", function(e){ $("#out").text([ "type=" + e.type, "which=" + e.which, "pageX=" + e.pageX, "pageY=" + e.pageY, "target=" + e.target.tagName ].join("\n")); }); </script> </body> </html>
Output