I have this code:
$(function() {
$('.delete').click(function() {
$(this).closest('li').remove();
});
$('#items').change(function() {
if ($(this).is(':empty')) {
alert('No more conditions');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul id="items">
<li><a href="#" class="delete">Delete me</a></li>
</ul>
注意:解决方案必须与旧浏览器(如IE8)兼容。