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 8865163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:26:06+00:00 2026-06-14T16:26:06+00:00

I need this function to work after the page is loaded. The error is

  • 0

I need this function to work after the page is loaded.
The error is a missing ; before statement error on the true line.
Also when the checkbox toggle-all is clicked as “checked” I want it to mark the class in the table checkall checked as true and when toggle-all checkbox is clicked again, mark all checked boxes in the table false.
It seems almost right but some error with the brackets.

$(document).ready(function()  {
     $('#toggle-all, input:checkbox').click(
     function () {
        $('#table, :checkbox').attr(':checked','checked').true);
     },function(){
        $('#table :checkbox').attr(':checked').false);
     }
  );
});



 <section id="main">
     <form id="task-list"> <input id="toggle-all" name="toggle-all" type="checkbox" /> 
      </form>
 </section>

 <table class="table" >
     <tr>
         <td><input type="checkbox" class="checkall"  />item.todo </td>
         <td> item.name</td><td>
     </tr>
......  more rows
 </table>
  • 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-14T16:26:07+00:00Added an answer on June 14, 2026 at 4:26 pm

    Simple solution:

    $(document).ready(function() {
    
        $("#toggle-all").click(function() {
            $(".table input:checkbox").each(function() {
                $(this).prop("checked", !$(this).prop("checked"));
            });
        });
    
    });
    

    A bit more bullet-proof (always toggling all checkboxes together):

    $(document).ready(function() {
    
        $("#toggle-all").click(function() {
            $(".table input:checkbox").prop("checked", $(this).prop("checked"));
        });
    
    });​
    

    Demo: http://jsfiddle.net/Ck43Z/1/

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

Sidebar

Related Questions

Need something like this (for future loaded html to page!): $(document).on('ready', 'a', function(){ $(this).after('it
I need to make this function work everywhere, except IE6-7 $(function(){ window.scrollTo(0,300); }) Please
$('input').change(function(){ alert($(this).val()); }); $('input').val(1); This dont work. I need capture the change input with
I am creating a class for an application backbone and I need this function
i'm building this little function, what i need is this query to print me
I need this for calling a C function from Java class (JNI) and I
I have something like this: function showFunction () { // need position and place
I need to export my nodes like this: function recursive_simplify(node){ if(node.children){ for(var i =0;i<node.children.length;i++){
I need to add authentication to this function: function multiRequest($data, $options = array()) {
I have this function in my js file. I need to give time for

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.