Some simple jquery problems
Input type = "checkbox" name = "role_auth_ids []" class = "menus" value = "1"/>Permission management Add permission
Permission list
Permission allocation
I would like to ask how to use jquery to cancel the selection of 'add authorization', 'permission list', and 'permission allocation' when the selected permissions are managed, permission management is also automatically deselected. That is, when the checkbox of the last cell is deselected, the selected permission management is automatically canceled.
Reply to discussion (solution)
I suggest you read the jquery manual.
Juqery select all and reselect
$(function() { $('[name="role_auth_ids[]"]:eq(0)').click(function() { if($(this).prop('checked') == false) $('[name="role_auth_ids[]"]:gt(0)').prop('checked', false); }); $('[name="role_auth_ids[]"]:gt(0)').click(function() { var n = 0; $('[name="role_auth_ids[]"]:gt(0)').each(function() { if($(this).prop('checked')) n++; }); $('[name="role_auth_ids[]"]:eq(0)').prop('checked', n ? true : false); });})
The upstairs method is not acceptable. it does not mean full or inverse selection ~
Is that all and inverse? Have you tried?
Deselect the "add permission" and "permission list" check boxes for "permission management". the selected ones are not selected.
'Add authorization' and 'permission list' and 'permission assignment "can be selected, and" permission management "can be selected.
Neither 'add authorization' nor 'permission list' nor 'permission assignment "is selected, nor" permission management "is selected.
I just want to implement
'Add authorization' and 'permission list' and 'permission assignment "can be selected, and" permission management "can be selected.
Neither 'add authorization' nor 'permission list' nor 'permission assignment "is selected, nor" permission management "is selected.
But it cannot.
What does your prop mean ??
Oh, you can implement it. Previously, jquery does not support the prop method, but you can change it ~ Like