jquery - Call Javascript function when HTML table finishes loading -


i loading html table through django:

{%  m in pays %}                 <tr>                     <td><center>{{ m.bid }}</center></td>                     <td><center>{{ m.pdate }}</center></td>                     <td><center>{{ m.punt }}</center></td>                  </tr> 

after table has necessary rows filled up. want call function makes datatable.

function inittable(){          $('#pt').datatable(); } 

right now, initalizing when form submits. causes try , load on empty table. want initalize after table loads

whether put script after table

{%  m in pays %}                 <tr>                     <td><center>{{ m.bid }}</center></td>                     <td><center>{{ m.pdate }}</center></td>                     <td><center>{{ m.punt }}</center></td>                  </tr> {% endfor %}  <script> function inittable(){          $('#pt').datatable(); } </script> 

or put anywhere in page inside $( document ).ready()

$( document ).ready(function() {         $('#pt').datatable();     }); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -