Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How to uncheck all checkboxes except checkboxes in a table

    How to unchecked all checkboxes except checkboxes in a table whose id is passed as a variable to a function using jquery?

    Code:
    function Check(CurrentTable)
    {
    	//CurrentTable contains the id of the table passsed to Check function
    	$('input:checkbox[id!="'+CurrentTable  +'"]').attr('checked', false);			
    }

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Try this:
    Code:
    $('input:checkbox')
        .filter(function() {
            return $(this).closest('#' + CurrentTable).length == 0;
        })
       .prop('checked', false); //.prop() not .attr()
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • Users who have thanked glenngv for this post:

    Stranger (08-29-2013)

  • #3
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv View Post
    Try this:
    Code:
    $('input:checkbox')
        .filter(function() {
            return $(this).closest('#' + CurrentTable).length == 0;
        })
       .prop('checked', false); //.prop() not .attr()
    It works. Thank you very much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •