jquery - add class to element which grandgrandparent has no "display:none" style -
using jquery want add class select element if grandgrandparent hasn't style="display:none" atribute
html this( here don't want add class):
<div style"display:none"> <div> <div> <select></select> </div> </div> </div> and here want add class select element:
<div> <div> <div> <select></select> </div> </div> </div> is there possibility that?
first add missing equal sign :
style="display:none" then can :
$('select').addclass(function() { return $(this).parents().eq(2).is(':visible') ? 'myclass' : ''; });
Comments
Post a Comment