Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 选择除复选框或单选输入前面的标签以外的所有标签_Jquery - Fatal编程技术网

Jquery 选择除复选框或单选输入前面的标签以外的所有标签

Jquery 选择除复选框或单选输入前面的标签以外的所有标签,jquery,Jquery,给定以下表单,如何选择除复选框或单选输入前面的标签外的所有标签 <form> <label>Select This Label</label><input type="text" /> <label>Select This Label</label><input type="email" /> <label>Select This Label Main checkbox group</label

给定以下表单,如何选择除复选框或单选输入前面的标签外的所有标签

<form>
<label>Select This Label</label><input type="text" />
<label>Select This Label</label><input type="email" />
<label>Select This Label Main checkbox group</label><br>
<label>NOT THIS LABEL!</label><input type="checkbox" />
<label>NOT THIS LABEL!</label><input type="radio" />
<label>Select this arbitrary label just hanging out here</label>
</form>

诸如此类


编辑2*我需要在选择器中完全执行此操作。

尝试:

$("form").find("label").each(function(){
    if(!($(this).next().is("input[type='radio']") || ($(this).next().is("input[type='checkbox']")))){
        $(this).addClass("someclass");
    }
});

我认为仅仅使用选择器是不可能的

$('label').filter(function(){
    return !$(this).next().is('[type="radio"], [type="checkbox"]')
})

演示:

我需要在选择器中完全执行此操作。“我需要在选择器中完全执行此操作。”为什么?经典的家长回答“因为我说过”就足够了吗?我需要在选择器中完全执行此操作。@GeoffreyOchsner标记为解决方案,因为这似乎不可能。
$("form").find("label").each(function(){
    if(!($(this).next().is("input[type='radio']") || ($(this).next().is("input[type='checkbox']")))){
        $(this).addClass("someclass");
    }
});
$('label').filter(function(){
    return !$(this).next().is('[type="radio"], [type="checkbox"]')
})