jquery:如果ul为空

好吧,我有一个jQuery对话框,其中有一个表单,我在我的智慧终于试图弄清楚这一点…让我看看我是否可以说我想要做什么..

我有3个文本框。 #apInterest,#apPayment和#apPrincipal的确切顺序。

要做的基本英语条款:

在#apInterest中的keyup,如果.val小于0或大于99.99触发错误..否则检查ul#mylist是否有任何li,如果不是.hide

在#apPayment中的keyup,如果.val小于0,则触发错误,否则检查li隐藏的列表。

#apPrincipal与#apPayment完全相同

这一刻我有什么

$('#apInterest').live("keyup",function(e) {
var parent = $('.inter').parents("ul:first");
if ($('#apInterest').val() < 0 || $('#apInterest').val() > 99.99) {
    $('.inter').remove();
    $('#mylist').append('<li class="inter">Interest Rate cannot be below 0 or above 99.99</li>');
    $('#popuperrors').show();
    $(this).addClass('error');
} else {
    $(this).removeClass('error');
    $('.inter').remove();
    alert(parent.children().text);
    if (parent.children().length == 0){
        $('#popuperrors').hide();
    }
}
});

虽然我也试过

if ($("#mylist :not(:contains(li))") ){
$('#popuperrors').hide();
}

我有一个类似于所有3个文本框的功能,但没有一个我尝试似乎工作..任何想法如何完成这个

解决方法

if ($('#mylist li').length == 0) ...

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...