Țaman ŞheƦzad Țaman ŞheƦzad -4 years ago 157
HTML Question

css adjacent Sibling combinators - complected selecting

In the below code How do i go about selecting the "title" class but IF the "subnav" class exists?

<ul class="flexMenu-popup">

<a href="x" class="title">

<ul class="subnav">


Answer Source

I'm not sure this is possible with CSS, but it's quite simple with jQuery:

var $ul = $('a.title', $('ul.flexMenu-popup > li > ul.subnav').parent());

if ($ul.length) {
else {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download