I want to create a rule to target the a element in the following:
If you're matching the a do this:
var result = $('#root > li:not(:has(ul)) > a');
If you want to allow deeper nested elements, and just want to check to make sure only the direct children don't have a , you could do this:
var result = $('#root > li:not(:has(> ul)) > a');
EDIT:
To have more than one selector at the same time, separate them with a comma inside the quotes:
var result = $('#root > li:not(:has(> ul)) > a, #someOtherElement');