Javascript 如何包装<;德尔></德尔>;在jquery中包含值的复选框周围的元素
我正在尝试这段代码,但它不起作用。请帮助,jquery新手 我的HTMLJavascript 如何包装<;德尔></德尔>;在jquery中包含值的复选框周围的元素,javascript,jquery,Javascript,Jquery,我正在尝试这段代码,但它不起作用。请帮助,jquery新手 我的HTML <div class="has-success topSpaceFromRoof"> <div class="checkbox"> <label> <input type="checkbox" id="checkboxSuccess" value="option1"> SAM C WILL HAVE BACON
<div class="has-success topSpaceFromRoof">
<div class="checkbox">
<label>
<input type="checkbox" id="checkboxSuccess" value="option1"> SAM C WILL HAVE BACON
</label>
</div>
</div>
山姆要培根
我的JAVASCRIPT
$("input[type=checkbox]").click(function() {
if ($(this).click) {
$(this).attr('disabled', 'disabled').wrapAll('<del></del>');
}
});
$(“输入[type=checkbox]”)。单击(函数(){
如果($(此)。单击){
$(this.attr('disabled','disabled').wrapAll('');
}
});
请参见下面代码中的内联注释
$("input[type=checkbox]").click(function() {
// Check if checkbox is checked
if ($(this).is(':checked')) {
$(this).attr('disabled', 'disabled'); // Disable checkbox
var checkboxHtml = $(this).closest('label').html(); // Get the checkbox with the name of it
$(this).closest('label').html('<del>' + checkboxHtml + '</del>'); // Wrap it in `del` tag
}
});
$(“输入[type=checkbox]”)。单击(函数(){
//检查复选框是否已选中
如果($(this).is(':checked')){
$(this.attr('disabled','disabled');//禁用复选框
var checkboxHtml=$(this).closest('label').html();//获取带有其名称的复选框
$(this).closest('label').html(“”+checkboxHtml+“”);//将其包装在'del'标记中
}
});
请参见下面代码中的内联注释
$("input[type=checkbox]").click(function() {
// Check if checkbox is checked
if ($(this).is(':checked')) {
$(this).attr('disabled', 'disabled'); // Disable checkbox
var checkboxHtml = $(this).closest('label').html(); // Get the checkbox with the name of it
$(this).closest('label').html('<del>' + checkboxHtml + '</del>'); // Wrap it in `del` tag
}
});
$(“输入[type=checkbox]”)。单击(函数(){
//检查复选框是否已选中
如果($(this).is(':checked')){
$(this.attr('disabled','disabled');//禁用复选框
var checkboxHtml=$(this).closest('label').html();//获取带有其名称的复选框
$(this).closest('label').html(“”+checkboxHtml+“”);//将其包装在'del'标记中
}
});
请参见下面代码中的内联注释
$("input[type=checkbox]").click(function() {
// Check if checkbox is checked
if ($(this).is(':checked')) {
$(this).attr('disabled', 'disabled'); // Disable checkbox
var checkboxHtml = $(this).closest('label').html(); // Get the checkbox with the name of it
$(this).closest('label').html('<del>' + checkboxHtml + '</del>'); // Wrap it in `del` tag
}
});
$(“输入[type=checkbox]”)。单击(函数(){
//检查复选框是否已选中
如果($(this).is(':checked')){
$(this.attr('disabled','disabled');//禁用复选框
var checkboxHtml=$(this).closest('label').html();//获取带有其名称的复选框
$(this).closest('label').html(“”+checkboxHtml+“”);//将其包装在'del'标记中
}
});
请参见下面代码中的内联注释
$("input[type=checkbox]").click(function() {
// Check if checkbox is checked
if ($(this).is(':checked')) {
$(this).attr('disabled', 'disabled'); // Disable checkbox
var checkboxHtml = $(this).closest('label').html(); // Get the checkbox with the name of it
$(this).closest('label').html('<del>' + checkboxHtml + '</del>'); // Wrap it in `del` tag
}
});
$(“输入[type=checkbox]”)。单击(函数(){
//检查复选框是否已选中
如果($(this).is(':checked')){
$(this.attr('disabled','disabled');//禁用复选框
var checkboxHtml=$(this).closest('label').html();//获取带有其名称的复选框
$(this).closest('label').html(“”+checkboxHtml+“”);//将其包装在'del'标记中
}
});
这可能就是您要找的 代码
$("input[type=checkbox]").click(function() {
if($(this).is(":checked")){
$(this).attr('disabled', 'disabled').wrap('<del data-value='+$(this).attr("value")+'></del>');
}
});
$(“输入[type=checkbox]”)。单击(函数(){
如果($(this).is(“:checked”){
$(this.attr('disabled','disabled').wrap('');
}
});
这可能就是您要找的
代码
$("input[type=checkbox]").click(function() {
if($(this).is(":checked")){
$(this).attr('disabled', 'disabled').wrap('<del data-value='+$(this).attr("value")+'></del>');
}
});
$(“输入[type=checkbox]”)。单击(函数(){
如果($(this).is(“:checked”){
$(this.attr('disabled','disabled').wrap('');
}
});
这可能就是您要找的
代码
$("input[type=checkbox]").click(function() {
if($(this).is(":checked")){
$(this).attr('disabled', 'disabled').wrap('<del data-value='+$(this).attr("value")+'></del>');
}
});
$(“输入[type=checkbox]”)。单击(函数(){
如果($(this).is(“:checked”){
$(this.attr('disabled','disabled').wrap('');
}
});
这可能就是您要找的
代码
$("input[type=checkbox]").click(function() {
if($(this).is(":checked")){
$(this).attr('disabled', 'disabled').wrap('<del data-value='+$(this).attr("value")+'></del>');
}
});
$(“输入[type=checkbox]”)。单击(函数(){
如果($(this).is(“:checked”){
$(this.attr('disabled','disabled').wrap('');
}
});
什么是<代码>$(此)。单击?什么是<代码>$(此)。单击?什么是<代码>$(此)。单击?什么是<代码>$(此)。单击?