【发布时间】:2018-12-28 15:46:33
【问题描述】:
我在 html 中开发了一个代码,其中的复选框由 jquery 管理。
<tr>
<td>
<div class="checkbox">
<label><input type="checkbox" id="checkbox2"></label>
</div>
</td>
<td><p id="taks2">Task 2</p></td>
<td><span class="glyphicon glyphicon-trash"></span></td>
</tr>
jquery 脚本是这样的:
<script>
$(document).ready(function(){
$('#checkbox2').click(function(){
if($(this).is(":checked")){
$('#taks2').replaceWith('<s>' + $('#task2').text() + '</s>');
}
else if($(this).is(":not(:checked)")){
}
});
});
</script>
如果用户选中了复选框,则“任务 2”应转换为 Task(使用 del 或罢工标签后输出),如果未选中复选框,则应再次将其转换为上一个类似于“任务 2”的形式。
【问题讨论】:
-
我发布了一个不同的解决方案,只有
css
标签: javascript jquery html css jquery-plugins