[英]How you Hide/Show a table's borders in Javascript or JQuery
我想使用 JS 或 Jquery 在表格中隱藏和顯示邊框,但無法做到,請提供任何幫助。
<table Id="IdTable" name="nameTable">
<tr><td>Name</td><td>Age</td></tr>
<tr><td>Joseph</td><td>35</td></tr>
</table>
我試過了
document.getElementById("IdTable").style.border=1;
$("#IdTable").css.apply("border", "1");
我這樣做是為了讓你打開和關閉邊界。
邊框是屬性所以用作
//document.getElementById("IdTable").style.border=1; $('#IdTable').css('border', '1px solid');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <table Id="IdTable" name="nameTable"> <tr><td>Name</td><td>Age</td></tr> <tr><td>Joseph</td><td>35</td></tr> </table>
border
是一個屬性。 所以試試
document.getElementById("IdTable").border = 1;
<table Id="IdTable" name="nameTable"> <tr> <td>Name</td> <td>Age</td> </tr> <tr> <td>Joseph</td> <td>35</td> </tr> </table>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.