Some simple jquery problems-php Tutorial

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.