[英]does $(document).ready(function()) execute only after jsp is loaded
I am trying to use the datatable jquery plugin to a table that is populated by a JSP . 我正在尝试将datatable jquery插件用于由JSP填充的表。 I add the datatable initialisation in the
$(document).ready(function())
but for some reason the plugin is not able to perform the search or pagination . 我在
$(document).ready(function())
添加了数据表初始化,但由于某种原因,插件无法执行搜索或分页。 my code snippet is 我的代码片段是
<table class="data-table" id="test">
<thead>
<tr>
<th>value1</th>
<th>value2</th>
<th>value3</th>
<th>value4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="class1"><%= value.valueOne() %></td>
<td class="class2"><%= value.valueTwo() %></td>
<td class="class3"><%= value.valueThree() %></td>
<td class="class4"><%= value.valueFour() %></td>
</tr>
<%
}
%>
</tbody>
</table>
<script>
$(document).ready(function() {
alert("HELLO");
$('#test').dataTable();
});
</script>
Anybody else who has faced this issue , any help would be appreciated . 任何其他人遇到这个问题,任何帮助将不胜感激。
$(document).ready() function is executed when your full page is loaded, no matter where you write it in code. 无论您在代码中的哪个位置加载完整页面,都会执行$(document).ready()函数。 More info: http://learn.jquery.com/using-jquery-core/document-ready/
更多信息: http : //learn.jquery.com/using-jquery-core/document-ready/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.