javascript 使用 jQuery 更改表格的边框?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4506295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing the border with of a table with jQuery?
提问by prosseek
I have a table generated from Sphinx that has a border of width 1.
我有一个由 Sphinx 生成的表格,其边框宽度为 1。
<table border="1" class="docutils">
Can I change the border width to 0 using jQuery/javascript?
我可以使用 jQuery/javascript 将边框宽度更改为 0 吗?
回答by JasCav
Yes you can. You want to use the attr() functionlike this...
是的你可以。你想像这样使用attr() 函数......
$('table.docutils').attr('border', '0');
回答by Damien-Wright
I would tend to use the .css()function as opposed to .attr()... eg:
我倾向于使用该.css()功能而不是.attr()......例如:
$("table.docutils").css('border', 'none');
:)
:)
回答by Bhanu Prakash Pandey
use
利用
document.getElementById('myTable').border="0"
<table border="1" class="docutils" id="myTable">

