$('.item').each(function () {
// это работает
if ($(this).children('.item').length) {
// этот код уже не работает
}
});
<ul>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="40" type="text" value="dfgdfg "><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
<ul>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="85" type="text" value="fghfghj "><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
<ul>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="99" type="text" value="БНС "><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
</li>
</ul>
</li>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="118" type="text" value="dfgdfgdfg"><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
<ul>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="119" type="text" value="dfgdfh "><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
</li>
</ul>
</li>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="120" type="text" value="237/21 "><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
<ul>
<li>
<div class="item">
<form action="#" class="baseeidtform">
<span class="editBtn" title="Редактировать"><i class="glyphicon glyphicon-pencil"></i></span><span class="deleteBtn" title="Удалить"><i class="glyphicon glyphicon-trash"></i></span><input class="baseinput" disabled="" data-edit="121" type="text" value="sdgfdkfguhdkfgujh"><span class="saveBtn dn" title="Сохранить"><i class="glyphicon glyphicon-ok"></i></span><span class="closeBtn dn" title="Отменить"><i class="glyphicon glyphicon-remove"></i></span>
</form>
</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
почему не ловит все дочерние элементы в if ?