Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get clicked element class in jquery

// HazaaZOOZ - jquery - how to get clicked element class in jquery

  // Example to get Class of Clicked Element using alert

  // Your jquery code
  $(document).on("click", function(event){
      alert(event.target.className);
  })
  
  // Your HTML code
    <button type="button" class="YourFirstClass">First Button</button>
    <input type="button" class="YourSecondClass" value="Second Button">
    <button type="button" class="YourThirdClass">Third Button</button>
    
  // Not forget to add script into the head tag
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  
  
    
 
PREVIOUS NEXT
Tagged: #clicked #element #class #jquery
ADD COMMENT
Topic
Name
4+4 =