欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          jquery怎么隱藏table列

          方法:1、利用find()和eq()方法根據(jù)指定列的索引值獲取指定列的元素對象,語法為“tr元素對象.find('th或td元素對象:eq(索引值)')”;2、利用hide()方法將獲取的指定列隱藏即可,語法為“指定列對象.hide()”。

          jquery怎么隱藏table列

          本教程操作環(huán)境:windows10系統(tǒng)、jquery3.2.1版本、Dell G3電腦。

          jquery怎么隱藏table列

          find() 方法返回被選元素的后代元素。

          eq() 方法返回帶有被選元素的指定索引號的元素。

          索引號從 0 開頭,所以第一個元素的索引號是 0(不是 1)。

          $(selector).eq(index)
          • index 必需。規(guī)定元素的索引??梢允钦麛?shù)或負(fù)數(shù)。

          hide() 方法隱藏被選元素。

          $(selector).hide(speed,easing,callback)
          • speed 可選。規(guī)定隱藏效果的速度。

          • easing 可選。規(guī)定在動畫的不同點上元素的速度。默認(rèn)值為 "swing"。

          • callback 可選。hide() 方法執(zhí)行完之后,要執(zhí)行的函數(shù)。

          示例如下:

          <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>123</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $('tr').find('th:eq(0)').hide();  $('tr').find('td:eq(0)').hide(); }); $(".btn2").click(function(){ $('tr').find('th:eq(0)').show();  $('tr').find('td:eq(0)').show(); }); }); </script> </head> <body> <table border="1">   <tr>     <th>Month</th>     <th>Savings</th>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr> </table> <button class="btn1">隱藏</button> <button class="btn2">顯示</button> </body> </html>

          輸出結(jié)果:

          jquery怎么隱藏table列

          相關(guān)視頻教程推薦:jQuery視頻教程

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號