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

  • Home
  • SEARCH
  • 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 8744925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:55:18+00:00 2026-06-13T11:55:18+00:00

I have a view with checkboxes, generated dynamically, and a button for chech/unchek all

  • 0

I have a view with checkboxes, generated dynamically, and a button for chech/unchek all the checkboxes. I try the code bellow but, the checkboxes are not checked ob button click event. Please help.
Thank you.

View with checkboxes:

 <button id="selectinvert" name="selectinvert" class="clear-selection ui-btn-hidden" aria-disabled="false" > Select / Deselect All</button>
    @for (int i = 0; i < @Model.workDaysList.Count; i++)
        {
              <div class="framed">
                 <div data-role="collapsible" data-collapsed="true" class="ui-btn-inner ui-corner-top ui-corner-bottom">
                   <h3>
                            <div class="ui-checkbox" id="checkbox">
                                <input type="checkbox" id="@Model.workDaysList[i][0]" />
                                <span class="ui-btn-text">
                                    <label for="@Model.workDaysList[i][0]" data-theme="c">
                                        @Model.workDaysList[i][1].Substring(6, 2)/@Model.workDaysList[i][1].Substring(4, 2)/@Model.workDaysList[i][1].Substring(0, 4)
                                    </label>
                                </span>
                                </div>
                            </h3>
                            @Model.detailDaysList[i][0] / @Model.detailDaysList[i][1]
                            <br />
                            @Model.detailDaysList[i][2] / @Model.detailDaysList[i][3]
                            <br />
                            @Model.detailDaysList[i][4] h
                        </div>
                    </div>
                </div>
           }

Jquery code:

<script type="text/javascript">
     $(document).ready(function () {
       $("#selectinvert").click(function () {
       $("INPUT[type='checkbox']").each(function () {
                    if (this.checked == false) {
                        this.checked = true;
                    } else {
                        this.checked = false;
                    }
                });
          });
    });
    </script>
  • 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-06-13T11:55:19+00:00Added an answer on June 13, 2026 at 11:55 am

    As others suggest, you were missing closing brackets.

    You could also shorten your code a bit:

    $("#selectinvert").click(function() {
        $("input[type='checkbox']").each(function() {
            this.checked = !this.checked;
        });
    });
    

    Also note that your problem has nothing to do with ASP.NET or jQuery UI.
    ​

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

Sidebar

Related Questions

I am using asp.net mvc. I have generated a view that retrieve all unapproved
I have a view with a few checkboxes that can be selected or unselected.
I'm using the SimpleFormController and have checkboxes in the view. When the form is
i have view like 'home/details/5', it can be access by anonymous user. but there
i have view controller which contains a button which show the image library ,if
I have made one custom ListView but it is not calling any onclick listener
I have a view model with a from that includes a set of checkboxes.
I am implementing in Ruby on Rails, and I have a view, with all
I'm using Entity Framework Code First to generated my database, so I have an
I have a Tree View control for a Windows Application that uses the CheckBoxes

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.