Figuring out how to use a conditional statement if children exist...

Figuring out how to use a conditional statement if children exist...

So I'm new to jQuery and loving it!  I just got stuck on a problem that I'm not sure how to work around.  I'm trying to add a class to a li item in a navigation if it has child list items underneath it.  For example, if I have this situation:
  1. <ul>
  2. <li><a href="#">List Item 1</a>
  3. <ul>
  4. <li><a href="#">Sub List Item 1</a></li>
  5. </ul>
  6. </li>
  7. <li><a href="#">List Item 2</a></li>
  8. </ul>

So in this situation, since List Item 1 has list items underneath it (children), I want to be able to append a class to it like so:
  1. <li class="foo"><a href="#">List Item #1</a></li>


I've attempted this, but it appends class to all the list items...even those that have no "2nd Level" list items:
  1.     if ($('#headerNav ul li a').is(':parent')) {
            $('#headerNav ul li').append('class="standalone"');
        }




Any insight for a fledgling beginner would be much appreciated.  Thanks!