开发者

How to merge two $(document).ready(function() in jQuery

开发者 https://www.devze.com 2023-03-05 11:02 出处:网络
<script src=\"jQuery/jquery.tablesorter.min.js\"></script> <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js\"></script>
<script src="jQuery/jquery.tablesorter.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>



$(document).ready(function() {

    $("#myTable").tablesorter({

    });

    $("#accordion").accordion({ 
        autoHeight: false, collapsible: true, active: false
    });



});

...

<div id="accordion">
    <h3><a href="#">First header</a></h3>
    <div>First content</div>
    <h3><a href="#">Second header</a></h3>
    <div>Second content</div>
</div>

<table border =1 cellpadding =8 id="myTable" class="tablesorter开发者_如何学Python" WIDTH="80%">
<thead>
<th><h3> Date </h3></th>
<th><h3> Report </h3></th>
</thead><tbody>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</tbody></table>


tablesorter needs to load after jquery

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
 <script src="jQuery/jquery.tablesorter.min.js"></script> 
0

精彩评论

暂无评论...
验证码 换一张
取 消