Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7682543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:35:33+00:00 2026-05-31T18:35:33+00:00

I am using jquery multiselect in my project,when user clicks on checkall then how

  • 0

I am using jquery multiselect in my project,when user clicks on checkall then how can i stop this function to check last option in jquery multiselect?

like if i have 4 option in my jquery multiselect and if user clicks on check all i want intial three option to be checked but last option is unchecked.
any help would be much appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:35:34+00:00Added an answer on May 31, 2026 at 6:35 pm

    Here you go updated solution here for plugin as well normal multiple checkbox with demo!

    Solution for multiselect Checkbox special condition to uncheck last checkbox on checkall

    Working MultiSelect jsfiddle for specific case regarding @Gautam’s multiselect plugin: http://jsfiddle.net/fG6PT/82/

    HTML:

    <select multiple="multiple" class='multi'>
    <option value="foo">foo</option>
    <option value="bar">bar</option>
    <option value="baz">baz</option>
    <option value="toy">toy</option>
    </select>
    

    JQuery

    $('.multi').multiselect({
    
        // Uncheck the last checkbox when chaeckall happens.
        checkAll: function () {
    
           if ($(this).is(":last") == true){
    
              var arr = $(this).val().toString().split(',');
               // Work on the array length alert('===>' + arr.length);
               var l = arr.length;
               for(i=(l-1);i<l;i++){
                   // so whatever the lenght is aim for the last element
                     $('input:checkbox[value="' + arr[i] + '"]').attr('checked', false);
               }
            }
        }
    
    });
    

    Solution below is for normal Chckbox

    Working example here: http://jsfiddle.net/Ev7FX/5/

    http://jsfiddle.net/Ev7FX/4/

    Html

    <input type="checkbox" name="check[]" value="1" />
    <input type="checkbox" name="check[]" value="2" />
    <input type="checkbox" name="check[]" value="3" />
    <input type="checkbox" name="check[]" value="4" />
    <a href="#" title="" id="check">check all</a> <a href="#" title="" id="uncheck">uncheck all</a>​
    

    JQuery Code

    var all_checkboxes = jQuery(':checkbox');
    
    jQuery('#check').on('click', function(event){
        event.preventDefault();
           all_checkboxes.not(':last').prop('checked', true);
    });
    
    jQuery('#uncheck').on('click', function(event){
        event.preventDefault();
        all_checkboxes.prop('checked', false);
    });​
    

    This will help, cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery 1.7.2 $(function(){ $('#parentElem').mouseenter(function(){ $('.myElem').animate({opacity:1}, 'fast'); }).mouseleave(function(){ $('.myElem').stop().animate{opacity:0}, 'slow'); }); }); In this
Using jQuery, how do you check if there is an option selected in a
I'm using the following jquery multiselect plugin ... How can I grab the selected
I'm using the following jquery multiselect plugin ... How can set the selectedText as
I'm using the jquery multiselect control from: http://abeautifulsite.net/notebook/62 I need to manually check one
I am using a jquery multiselect plugin http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ with option. All works fine, however
I've been using this tutorial to create a screen where a user can add
I'm using this plugin http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ and it works awesome!! but I'd like to make
I am using Jquery UI like this: $(#companyType).multiselect({ multiple: false, header: Type, noneSelectedText: Type,
So the situation is this: attempting to add a dropdown box using the jquery.multiselect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.