javascript - How to merge two $(document).ready(function() in jQuery -
<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" 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 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>
Comments
Post a Comment