选择班级控制组,其中其所有子级都不是span.error [英] Select class control-group where none of its children are span.error
本文介绍了选择班级控制组,其中其所有子级都不是span.error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用twitter bootstrap和jquery validate插件
I am working with twitter bootstrap and the jquery validate plugin
我有一个看起来像这样的表格行:
I have a form row that looks like:
<div class="form_row" >
<div class="control-group">
<label class="control-label" for="input01">home phone</label>
<div class="controls">
<input type="number" class="span4" class="input-xlarge" id="home_phone" name="home_phone" value="<?php echo $this->property->home_phone ?>" rel="popover" data-content="Re-enter your home phone." data-original-title="homephone" >
<input type="number" class="span4" class="input-xlarge" id="cell_phone" name="cell_phone" value="<?php echo $this->property->cell_phone ?>" rel="popover" data-content="Re-enter your cell_phone." data-original-title="cell_phone" >
</div>
在验证之后,当我在firebug中查看它时,输入错误的后面是span.error.我想选择类控制组,其中所有子级都不是span.error.我将不胜感激任何帮助.
after validation, when I look at it in firebug, the inputs with errors are followed by span.error.I would like to select class control-group where none of its children are span.error. I would appreciate any help.
谢谢,比尔
推荐答案
怎么样:
$('.control-group').not($('.control-group span.error').closest('.control-group')).
http://jsfiddle.net/zerkms/Dhe4j/
在jsfiddle示例中,我们选择所有未嵌套span.error
的.control-group
并将其设为红色.
In the jsfiddle example we select all the .control-group
which don't have nested span.error
and make them red.
这篇关于选择班级控制组,其中其所有子级都不是span.error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文