I\'m using an if statement in order to determine if an element has any children. If it does NOT have any children, I want to do something to that element only.
if
Edit: Added DEMO Link
You can use .filter to check the condition and call .hide on the filter results. See below,
.filter
.hide
$("#div a").filter(function () { return ($(this).children().length > 0) }).hide();