Monday, January 11, 2016

$(document).on('click', check which class is clicked for multiple classes




For example, jquery, click:
 $(document).on('click',  '.sendmail00, .sendmailq',function(){
I want to check which class is clicked? .sendmail00 or .sendmailq?
We can check its parent to contain this class or not.
Examples, suppose both of classes have parents td,
    $(document).on('click',  '.sendmail00, .sendmailq',function(){
                     var $td = $(this).parents('td');

      if($td.find('.sendmailq').html()==null ||$td.find('.sendmailq').html()==undefined)  
        alert('Not contain class  .sendmailq');
      else
        alert('Contain class  .sendmailq');
 });

No comments:

Post a Comment