JS function detect which div is being clicked

Useful when debuging on mobile where you can’t open tag inspector.

jQuery( document ).ready(function() { 
  jQuery("div").click(function() { 
    var myClass = jQuery(this).attr("class"); 
    alert(myClass); 
  }); 
});

 

Illustration by tamypu

No votes yet.
Please wait...

Leave a comment

Your email address will not be published.