javascript - Check All box does not work with Jquery DataTable version 1.10.5 -


i have jquery datatable 3 columns (check box column, userid, full name). 'check_all' check box worked fine (meaning rows checked when 'check_all' clicked) when used jquery.datatables.js , jquery.datatables.min.js version 1.9.4. however, have use datatable version 1.10.5 in order use "draw()" function. once started using new version, check_all checkbox stopped working, alert() inside .click() didn't invoked. tried put .click function inside $(document).ready(), didn't fix issue. has idea ? thanks!!

script:

 $('#check_all').click(function()   {           alert("here");     var otable = $('#users').datatable();   }); 

html part:

<div id ="tablepanel">    <table class="usertable" cellpadding="4" rules="all" border="1" id="users">             <thead>                                                                           <tr>                                                <th><input type="checkbox" id ="check_all"  class="call-checkbox" name="check_all">select  users</th>            <th>user id</th>            <th>full name</th>           </tr>       </thead>       <tbody>       <tbody>     </table>    </div> 

you missing closing ")" on click event handler function. should ensure bindings occur after dom ready placing them inside jquery's document.ready() function.

the full syntax $(document).ready(function () { .. }); can shortened $(function() { ... });

$(function () {     $('#check_all').click(function () {         alert("here");         var otable = $('#users').datatable();     }); }); 

demo: http://jsfiddle.net/benjaminray/qe0ckve8/


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -