Jquery 删除表单内联类
我正在我的应用程序中使用材料设计引导数据表 引导的表单内联类与数据库样式冲突 htmlJquery 删除表单内联类,jquery,html,css,twitter-bootstrap,datatables,Jquery,Html,Css,Twitter Bootstrap,Datatables,我正在我的应用程序中使用材料设计引导数据表 引导的表单内联类与数据库样式冲突 html <table id="example" class="mdl-data-table" cellspacing="0" width="100%"> <thead> <tr> <th>Name</th> <th>Position</th>
<table id="example" class="mdl-data-table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
</tbody>
</table>
试试这个代码
<script type="text/javascript">
$(document).ready(function() {
var table = $('#example').DataTable( {
columnDefs: [
{
targets: [ 0, 1, 2 ],
className: 'mdl-data-table__cell--non-numeric'
}
]
} );
$( table.table().container() ).removeClass( 'form-inline' );
} );
</script>
$(文档).ready(函数(){
变量表=$(“#示例”)。数据表({
columnDefs:[
{
目标:[0,1,2],
类名:“mdl-data-table__单元格--非数字”
}
]
} );
$(table.table().container()).removeClass('forminline');
} );
为什么需要.table()?要删除一个类吗?难道不能只使用$(“table”).removeClass('forminline')?只需查看此链接$(“table”).removeClass('forminline');不工作如果可能,创建工作代码段。
$( table.table().container() ).removeClass( 'form-inline' );
<script type="text/javascript">
$(document).ready(function() {
var table = $('#example').DataTable( {
columnDefs: [
{
targets: [ 0, 1, 2 ],
className: 'mdl-data-table__cell--non-numeric'
}
]
} );
$( table.table().container() ).removeClass( 'form-inline' );
} );
</script>