我有这个表格:
<div id="div_id_form-0-FIELD1" class="form-group">
<label for="id_form-0-FIELD1" class="control-label col-sm-2">
Amount Type
</label>
<div class="controls col-sm-3">
<select class="select form-control" id="id_form-0-FIELD1" name="form-0-FIELD1">
<option value="">---------</option>
<option value="d" selected="selected">Dollars</option>
<option value="p">Percent of</option>
</select>
</div>
</div>
<div id="div_id_form-0-FIELD2" class="form-group">
<label for="id_form-0-FIELD2" class="control-label col-sm-2">
Deduct from total
</label>
<div class="controls col-sm-3">
<select class="select form-control" id="id_form-0-FIELD2" name="form-0-FIELD2">
<option value="" selected="selected">---------</option>
<option value="g">Gross Pay</option>
<option value="n">Net Pay</option>
<option value="h">Hourly Rate</option>
</select>
</div>
</div>
我FIELD1
进去了($this)
,我想得到FIELD2
。这不是给我的:
$(this).closest(("select[name*='FIELD2']")
使用.next()
方法,如下所示:
$(this)
.closest("div.form-group")
.next("div.form-group")
.find("select[name*='FIELD2']");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句