我想删除表格中的div。我试图删除使用Jquery但没有运气。
$(document).ready(function(){
$('c5_r7_c2_graphical').remove();
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<table>
<tr id="c5_r7_row" class="grid_row7"><td class="row_label_cell alt_color2 grid_r7 c5_r7" width="40%"><div class="grid_options">
<b>Guidance websites (e.g. Money Advice Service), online forums or online reviews</b></div></td>
<td class="input_cell clickable alt_color2 grid_r7 grid_c1 c5_c1 " width="12%" nowrap=""><input name="c5_r7_c1" value="1" type="checkbox" id="c5_r7_c1" class="HideElement">
<div id="c5_r7_c1_graphical" class="graphical_select checkbox" tabindex="159"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c2 c5_c2 " width="12%" nowrap=""><input name="c5_r7_c2" type="checkbox" id="c5_r7_c2" class="HideElement" value="1">
<div id="c5_r7_c2_graphical" class="graphical_select checkbox" tabindex="162"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c3 c5_c3 " width="12%" nowrap=""><input name="c5_r7_c3" value="1" type="checkbox" id="c5_r7_c3" class="HideElement">
<div id="c5_r7_c3_graphical" class="graphical_select checkbox" tabindex="165"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c4 c5_c4 " width="12%" nowrap=""><input name="c5_r7_c4" value="1" type="checkbox" id="c5_r7_c4" class="HideElement">
<div id="c5_r7_c4_graphical" class="graphical_select checkbox" tabindex="168"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c5 c5_c5 " width="12%" nowrap=""><input name="c5_c5" value="7" type="radio" id="c5_c5_7" class="HideElement">
<div id="c5_c5_7_graphical" class="graphical_select radiobox" tabindex="171"></div></td></tr>
</table>
&#13;
我试图实现的是通过td清空而不删除,只想删除td值。
请帮助!!!
答案 0 :(得分:0)
您缺少选择器 - 在本例中为#
:
$(document).ready(function(){
$('#c5_r7_c2_graphical').remove();
});
答案 1 :(得分:0)
确保已包含jquery库文件。
$(document).ready(function(){
$('#c5_r7_c2_graphical').remove();
});
答案 2 :(得分:0)
你缺少#,如果在添加#后这不起作用,那么请确保你的页面中包含了jquery。
这是工作示例
$(document).ready(function(){
$('#c5_r7_c2_graphical').remove();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr id="c5_r7_row" class="grid_row7"><td class="row_label_cell alt_color2 grid_r7 c5_r7" width="40%"><div class="grid_options">
<b>Guidance websites (e.g. Money Advice Service), online forums or online reviews</b></div></td>
<td class="input_cell clickable alt_color2 grid_r7 grid_c1 c5_c1 " width="12%" nowrap=""><input name="c5_r7_c1" value="1" type="checkbox" id="c5_r7_c1" class="HideElement">
<div id="c5_r7_c1_graphical" class="graphical_select checkbox" tabindex="159"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c2 c5_c2 " width="12%" nowrap=""><input name="c5_r7_c2" type="checkbox" id="c5_r7_c2" class="HideElement" value="1">
<div id="c5_r7_c2_graphical" class="graphical_select checkbox" tabindex="162">This will be removed</div>
</td><td class="input_cell clickable alt_color2 grid_r7 grid_c3 c5_c3 " width="12%" nowrap=""><input name="c5_r7_c3" value="1" type="checkbox" id="c5_r7_c3" class="HideElement">
<div id="c5_r7_c3_graphical" class="graphical_select checkbox" tabindex="165"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c4 c5_c4 " width="12%" nowrap=""><input name="c5_r7_c4" value="1" type="checkbox" id="c5_r7_c4" class="HideElement">
<div id="c5_r7_c4_graphical" class="graphical_select checkbox" tabindex="168"></div></td><td class="input_cell clickable alt_color2 grid_r7 grid_c5 c5_c5 " width="12%" nowrap=""><input name="c5_c5" value="7" type="radio" id="c5_c5_7" class="HideElement">
<div id="c5_c5_7_graphical" class="graphical_select radiobox" tabindex="171"></div></td></tr>
</table>