【发布时间】:2014-07-31 07:51:15
【问题描述】:
我正在尝试将我的 radio 输入及其 label 包装在一个 div 中,但不知何故它不仅仅包装了输入。我的代码是:
HTML 是:
<div class="payment_processor-section">
<input id="input_0" class="form-radio" type="radio" checked="checked" name="payment_processor" value="1">
<label for="input_0">Credit Card</label>
<input id="input_1" class="form-radio" type="radio" name="payment_processor" value="0">
<label for="input_1" style="">I will send payment by check</label>
</div>
我正在尝试的 Jquery 是:
$('.payment_processor-section input').map(function(index){
$(this, $("label[for='"+this.id+"']") ).wrapAll('<div class="abc">');
});
请帮忙。
【问题讨论】:
标签: jquery html jquery-selectors dom-traversal