我有这样的桌子..
<table id="content" style ="border:none>
<tr>
<td>
<table id="content_medium" style ="width:100%">
<tr class="grid_heading">
<th class="student">Students</th>
<th class="year">Year</th>
<th class="group">Roll Group</th>
<th class="Type">Session</th>
</tr>
</table>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
如何使用jquery更改表的宽度..我有按钮,单击时应添加宽度100%,并在下次单击时删除宽度属性..
喜欢?
function openpartialView() {
$(".content").addcss("width","100%");
}
function closepartialView() {
$(".content").removecss("width", "100%");
}
Run Code Online (Sandbox Code Playgroud)
灵活的解决方案是动态添加/删除类而不是样式.
JS:
$("#content").addClass('fullwidth');
$("#content").removeClass('fullwidth');
Run Code Online (Sandbox Code Playgroud)
CSS:
.fullwidth{
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)