javascript - jquery addClass to element if css has style -
please have @ following question , answer, seccond answer (with many upvotes) jquery: how check if element has css class/style
looks this:
if ($('#yourelement').css('position') == 'absolute') { // true } so awesome like
if ($('#yourelement').css('position') == 'absolute') { $(this).addclass('xxx'); } so element id "yourelement" gets class added
what easyest way that
you way:
$('#yourelement').addclass(function(index, currentclass) { return $(this).css('position') == 'absolute' ? 'xxx' : ''; }); for more information on syntax take @ api .addclass().
Comments
Post a Comment