I have a DIV like this:
<div id="containerContent"></div>
Sometimes there are child DIV’s within the above DIV and sometimes not.
I need a way to check if there are NO child DIV’s within “containerContent” DIV so I can then perform an action.
I’ve tried this unsuccessfully:
if(!$('div#containerContent').children('div')) {
alert('missing');
}
thx
jQuery’s
children()method returns a jQuery object which will always evaluate totrue. Use thelengthproperty to determine the number of elements contained within the object.