samedi 29 novembre 2014

How to apply css style on the list of div by defending on the class name using javascript


Vote count:

-1




I got list of div that have a class name of design or coding. I want to put a condition that will add different css style.


HTML


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>

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');
}
}
});


asked 27 secs ago







How to apply css style on the list of div by defending on the class name using javascript

Aucun commentaire:

Enregistrer un commentaire