Target Elements that DO NOT HAVE SPECIFIC PARENT

by bizamajig

HTML

<ul>
  <li><a href="/artists/gil_elvgren/activity_stream"><div>Activity Stream</div></a></li>
  <li><a href="/artists/gil_elvgren/likes"><div>Likes</div></a></li>
    <li><div>Favorites</div></li>
  <li><div>Follows</div></li>
  <li><a href="/artists/gil_elvgren/sketchbook_comments"><div>Whiteboard</div></a></li>

</ul>

CSS

.current { color: cyan; }

JavaScript

$('div').not( function () {
//  return $(this).children('a').length;
    return $(this).parent('a').length || $(this).parent().parent('a').length;
}).addClass('current');