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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:55:08+00:00 2026-05-20T22:55:08+00:00

I have a table: in first row I have an anchor to click, in

  • 0

I have a table: in first row I have an anchor to click, in second – <asp:CheckboxList /> expanding to another table.

How can I access inputs inside that table using jQuery? I want to select all using one link, and deselect all using another one.

<table>
    <tr>
        <td>
            <table>
                <tbody>
                    <tr>
                        <td>
                            <!-- Anchor to click -->
                            <a onclick="do stuff" href="javascript://">Select all</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <!-- CheckboxList -->
            <table id="ctl00_commonForm_ctl00_ctl00_listCheck" class="list" border="0">
                <tbody>
                    <tr>
                        <td>
                            <!-- input to select -->
                            <input id="ctl00_commonForm_ctl00_ctl00_listCheck_0" name="ctl00$commonForm$ctl00$ctl00$listCheck$0" checked="checked" type="checkbox"><label for="ctl00_commonForm_ctl00_ctl00_listCheck_0">Date</label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input id="ctl00_commonForm_ctl00_ctl00_listCheck_1" name="ctl00$commonForm$ctl00$ctl00$listCheck$1" checked="checked" type="checkbox"><label for="ctl00_commonForm_ctl00_ctl00_listCheck_1">Amount</label>
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
</table>

I tried $(this).parent().('#list > input') but it doesn’t work. I’m not familiar with jQuery, so please help. Thanks!

  • 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-20T22:55:09+00:00Added an answer on May 20, 2026 at 10:55 pm

    This is the jQuery I think you need:

    // When the select link is clicked
    $('#selectall').click( function ( ) {
       \\ For each checkbox inside an element with class "link" set to checked
        $('.list input[type=checkbox]').attr('checked','checked');
    });
    

    You need to change your link to this:

    <a id="selectall" href="javascript:void( );">Select all</a>
    

    Similarly, for deselect, jQuery:

    $('#deselectall').click( function ( ) {
        $('.list input[type=checkbox]').removeAttr('checked');
    });
    

    Link:

    <a id="deselectall" href="javascript:void( );">Select all</a>
    

    Because it would hurt me not to, I’ve got to warn against using tables for laying out your form. It’s very bad practice these days, and you can make a layout that looks as good, but is more flexible, using divs and CSS. I’d go for:

    <div id="select_links">
        <!-- Anchor to click -->
        <a id="selectall" href="javascript:void( );">Select all</a>
        <a id="deselectall" href="javascript:void( );">Deselect all</a>
    </div>
    <div class="list">
        <div class="listItem">
            <input id="ctl00_commonForm_ctl00_ctl00_listCheck_0"
                   name="ctl00$commonForm$ctl00$ctl00$listCheck$0" checked="checked"
                   type="checkbox">
                   <label for="ctl00_commonForm_ctl00_ctl00_listCheck_0">Date</label>
        </div>
        <div class="listItem">
            <input id="ctl00_commonForm_ctl00_ctl00_listCheck_1"
                   name="ctl00$commonForm$ctl00$ctl00$listCheck$1" checked="checked"
                   type="checkbox">
            <label for="ctl00_commonForm_ctl00_ctl00_listCheck_1">Amount</label>
        </div>
    </div>
    

    EDIT: Mark’s right, that should have been removeAttr(checked), not attr('checked',null);

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

Sidebar

Related Questions

I have a table for which I want to display only the first row
In my html table I have two row, first row having no css but
I have a table with 3 rows. Each row has 3 td. The first
I have a DataSet , where in the first table and in the row
I have two table first is TABLE_SUBJECT and second is TABLE_CHAPTER.Now i want to
I have a first table view and a segue that pushes to another table
I have a table with many rows . first row is the header. i
I have a two table first is simple primary key based table and second
I have a table with a drop-down html selector in the first row. The
I have a table In the table first column displays a checkbox and second

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.