-1
<html>
<head>
<script>
function A(){
    $('input[name="B[]"]').each(function() { 
        if(('$(this) .BtnSet .Child input:text[name="A[]"]').length){
         //yes the Child class is inside JRow class and has textboxes with name A[]
        }
    });
    return false;
}
</script>
</head>
<body>
<form onsubmit="return A()">
    <div class="row JRow">
     <input type="text" name="B[]"></input>
     <input type="text" name="B[]"></input>
        <div class="BtnSet">
            <div class="Child">
                <input type="text" name="A[]"></input>
                <input type="text" name="A[]"></input>
            </div>
        </div>
    </div>
    <input type="submit" value="Submit"></input>
</form>
</body>
</html>

我需要检查 Child 类是否在行 JRow 类中,如果是,那么在 Child 类中是否有名称为 A[] 的任何文本框可用...

4

1 回答 1

2

尝试

if($('.JRow .BtnSet .Child input:text[name="A[]"]').length){
    //yes the Child class is inside JRow class and has textboxes with name A[]
}
于 2013-09-19T16:08:56.053 回答