Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Get Class of Clicked Element</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).on("click", function(event){ alert(event.target.className); }) </script> </head> <body> <button type="button" class="foo">Button 1</button> <input type="button" class="bar" value="Button 2"> <button type="button" class="baz">Button 3</button> </body> </html>