How to Check existing class name of an element in jQuery

To check and find the existing class name of an element inside HTML by jQuery you can use hasClass().

if($('#elm').hasClass('classname'))
 {
?  //Do whatever you want
 }
 else
 {
   //Do whatever you want
 }

http://api.jquery.com/hasClass/

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.