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

fiddle


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -