Jquery select/unselect works on simple html but not with php loop -


when click on select all, checkboxes checked , disabled, , when uncheck select all, checkboxes become unchecked , normal again.

then tried exact same thing retrieving data db loop , can select all, when deselect 'select all' unchecked disabled.. how can "undisable" it?

demo simple html version: http://jsfiddle.net/k6r7g/11/

the php version doesn't work:

<?php  echo '<input type="checkbox" name="category[]" class="category_all" value="0">all'; if ( $db_conn = conndb() ){     $sql_categories = "select * cat";     $rs = getrows($sql_categories, $db_conn);      foreach ($rs $row) {         echo '<input type="checkbox" class="categories_list" name="category[]" value="'.$row['cat_id'].'">'.$row['cat_name'].'';     }     $db_conn = null; }                                        ?> 

the rows echo fine in dropdown, deselection part of 'select all' isn't working. doing wrong?

please change:

$(".categories_list").prop("checked", is_checked).attr("disabled",  is_checked); 

to:

$(".categories_list").prop("checked", is_checked).prop("disabled",  is_checked); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -