How to check the element type of an event target with jQuery?

To check the element type pf an event target, using the is() method.


You can try to run the following code to check the element type:

Live Demo

<!DOCTYPE html>
<script src=""></script>
   $( "ul" ).click(function( event ) {
      var target = $( );
      if ( "li" ) ) {
         alert("Element is 'li'")
<p>Click below to find out which element</p>

Updated on: 11-Dec-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started