How to apply a different condition into list of li using loop. Thanks
I got list of li that have different classes. I got two classes Design & Coding. I want to jquery to detect the class of a li then apply certain condition. The condition will add style into the child co
HTML
<li class="Design"><a class="post-link"></a></li>
<li class="Design"><a class="post-link"></a></li>
<li class="Coding"><a class="post-link"></a></li>
JS
var workArray = [];
var $work = jQuery('.slide-container li');
var $workClass = $work.attr('class');
$work.each(function(){
workArray.push($workClass);
for(i = 0; i < workArray.length; i++){
if(jQuery(this).hasClass('Design')){
jQuery('.post-link').css('display','block');
}else{
jQuery('.post-link').css('display','none');
}
}
});