行のグループが選択されており、特定のクラスが含まれているかどうかを判断しようとしています。
hasClass
私は成功せずにそれを試しましたfind
:
var group = $('table').find('[data-group="group1"]');
//this doesn't work, it always enters in the condition
if(group.find('.active')){
alert("Founded?");
group.addClass('green');
}
私もそれを試しましたif(group.find('.active').length)
が、まだ正しい結果が得られません: