javascript - How to combine two $(document).ready callbacks with jQuery? -


is possible combine these 2 javascript $(document).ready functions together? if so, how?

code 1:

$(document).ready(function() {     $('#example').datatable( {         "scrolly": 280,         "scrollx": true,         "pagingtype": "simple",         dom: 't<"clear">lfrtip',         tabletools: {             "sswfpath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"         }     }); }); 

code 2:

$(document).ready(function() {     var table = $('#example').datatable();     var tt = new $.fn.datatable.tabletools( table );     $( tt.fncontainer() ).insertbefore('div.datatables_wrapper'); }); 

i assume asking if can move code inside second ready() first, call ready() 1 time? yes, , this.

$(document).ready(function() {     $('#example').datatable( {          "scrolly": 280,         "scrollx": true,         "pagingtype": "simple",         dom: 't<"clear">lfrtip',         tabletools: {             "sswfpath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"          }      });      var table = $('#example').datatable();     var tt = new $.fn.datatable.tabletools( table );      $( tt.fncontainer() ).insertbefore('div.datatables_wrapper');     } ); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -