jquery的显示和隐藏,show和hide失效。
代码如下:
<table >
<div id="gn">
<tr >
<th>aaaaa</th>
<td >
<textarea id="rules" name="rules" rows="12" cols=""></textarea>
</td>
</tr>
<div>
<div id="gw">
<tr >
<th>abc</th>
<td >
<textarea id="ruless" name="rules" rows="12" cols=""></textarea>
</td>
</tr>
<div>
</table>
$(function(){
$("#gw").hide();
});
这个js $("#gw").hide(); 不起作用,找了好久终于找到原因。
jquery的show和hide只针对本身起作用,对于div中有tr td标签的,不起作用。
只要把div去掉,在tr上加上id就可以了
代码如下:
<tr id="gn">
<th>aa</th>
<td >
<textarea id="rules" name="rules" rows="12" cols=""></textarea>
</td>
</tr>
<tr id="gw">
<th>bb</th>
<td >
<textarea id="ruless" name="rules" rows="12" cols=""></textarea>
</td>
</tr>
这样这个$("#gw").hide(); js就起作用了。
————————————————
版权声明:本文为CSDN博主「duni2013」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/duni2011/article/details/22059035