So, the elements should be changed into
<div class="icheckbox disabled hide_empty" style="">
that’s different from the goal stated in the question where you say you want to add class “hide_empty” to the parent <li>
of the <div class="icheckbox">
. The code posted by @dhirenpatel22 should work to add class hide_empty to the li element, of course if the element you want to add class to is the same div it should be
$(this).addClass('hide_empty')
Also note that hasClass() will return true even if the element has more classes.
To find only the divs with both and exclusively icheckbox + disabled I guess the best way is:
$(".icheckbox, .disabled").each(function(){
$(this).parent('li').addClass('hide_empty');
// or $(this).addClass('hide_empty')
//if it's the <div> instead of <li> you want to apply the rule
})