css - select div only if it contains select -


is there css selector selecting parent div if directly contains select inside ?

example code:

<div class="top_level">   <input type="radio"></input> </div> <div class="top_level">   <input type="text"></input> </div> <div class="top_level">   <select name="namehere">     <option>...</option>     <option>...</option>     <option>...</option>   </select> </div> 

suppose want select third 3rd top_level class div, since contains select directly inside it, how ?

i did try search around answer, couldn't find any. have been lot easier if parent selection possible in css.

if you're using jquery, can use :has :

$('div.top_level:has(select)') 

if you're using css, answer simple : no, don't have similar select parent.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -