我想添加一些内部每个th。表头是动态的生成依赖于数据库列使用JQuery追加一些文本到每个表头(th)
这是我有:
<table id="dynamic_id" class="table table-striped table-bordered">
<thead>
<tr>
<th>Company Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Address</th>
</tr>
</thead>
<tbody>
//body goes here
</tbody>
</tbody>
</table>
什么是ready事件使用jQuery期待。
<th>Company Name
<span class="js-sorter-desc fa fa-chevron-down pull-right"></span>
<span class="js-sorter-asc fa fa-chevron-up pull-right"></span>
</th>
这应该是适用于每一个钍..
<span class="js-sorter-desc fa fa-chevron-down pull-right"></span>
<span class="js-sorter-asc fa fa-chevron-up pull-right">
http://api.jquery.com/append –
欢迎堆栈溢出!请[参观],环顾四周,并通读[帮助],尤其是[*我如何提出一个好问题?](/帮助/如何问)做你的研究,包括看通过[jQuery API](http://api.jquery.com),并尝试完成这项工作。 **如果**在现场进行了更彻底的研究和[搜索](/帮助/搜索)后遇到*特定*问题,如果无法解决问题,请将您的尝试与您遇到的麻烦一起发布用它。人们会很乐意提供帮助。 –
如果表格是动态的,那么计算列的数量,然后在每个内部使用 –