Okay I have list items, some have a span, some not. On my event I want to add the span when they don\'t have any yet.
has() works fine, but
has()
You can use a combination of the :not and :has selectors like this
$("a.add-span").click(function() { $("li:not(:has(span))").each(function(index) { $(this).append('new span<\/span>'); }); });
Here is a demo http://www.jsfiddle.net/xU6fV/