亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    jquery中tr怎么刪除id屬性

    在jquery中,可以利用removeAttr()方法刪除tr元素的id屬性,該方法的作用就是從被選元素中移除屬性,將括號(hào)中的參數(shù)設(shè)置為“id”即可,語法為“需要?jiǎng)h除id屬性的tr元素對象.removeAttr("id");”。

    jquery中tr怎么刪除id屬性

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

    jquery中tr怎么刪除id屬性

    removeAttr() 方法從被選元素中移除屬性。

    語法

    $(selector).removeAttr(attribute)

    attribute 必需。規(guī)定從指定元素中移除的屬性。

    示例如下:

    <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <style> #city{ background-color:pink; } </style> <script type="text/javascript"> $(document).ready(function(){   $("button").click(function(){     $("tr").removeAttr("id");   }); }); </script> </head> <body> <table border="1">   <tr>     <th>Month</th>     <th>Savings</th>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr>   <tr id="city">     <td>January</td>     <td>$100</td>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr> </table> <button>刪除所有tr元素的id屬性</button> </body> </html>

    輸出結(jié)果:

    jquery中tr怎么刪除id屬性

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

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