jquery中如何让th元素隐藏(jquery,web开发)

时间:2024-05-05 03:37:48 作者 : 石家庄SEO 分类 : web开发
  • TAG :

方法:1、用“$("th").hide()”,通过添加display样式来隐藏;2、用“$("th").fadeOut()”或“$("th").fadeTo(毫秒,0)”,通过修改透明度来隐藏;3、用“$("th").slideUp()”。

jquery中如何让th元素隐藏

本教程操作环境:windows7系统、jquery1.10.2版本、Dell G3电脑。

<th> 标签定义 HTML 表格中的表头单元格。

例:

<tableborder="1"> <tr> <th>商品</th> <th>价格</th> </tr> <tr> <td>T恤</td> <td>¥100</td> </tr> <tr> <td>牛仔褂</td> <td>¥250</td> </tr> <tr> <td>牛仔库</td> <td>¥150</td> </tr></table><br>

jquery中如何让th元素隐藏

那么使用jquery让th元素隐藏

1、使用hide()

hide() 方法隐藏被选元素(通过给元素添加display:none样式来隐藏)。

$(document).ready(function(){ $("button").click(function(){ $("th").hide(); });});

jquery中如何让th元素隐藏

2、使用fadeOut()

fadeOut() 方法逐渐改变被选元素的不透明度,从可见到隐藏(褪色效果)。

$(document).ready(function(){ $("button").click(function(){ $("th").fadeOut(); });});

jquery中如何让th元素隐藏

3、使用fadeTo()

fadeTo() 方法逐渐改变被选元素的不透明度为指定的值(褪色效果)。

只需要将最终的不透明度设置为0即可。

$(document).ready(function(){ $("button").click(function(){ $("th").fadeTo(1000,0); });});

jquery中如何让th元素隐藏

4、使用slideUp()

slideUp() 方法以滑动方式隐藏被选元素。

$(document).ready(function(){ $("button").click(function(){ $("th").slideUp(); });});

jquery中如何让th元素隐藏

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:jquery中如何让th元素隐藏的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:php如何去掉数组的两个值下一篇:

32 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18