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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:10:34+00:00 2026-05-19T04:10:34+00:00

I have the following: <input name=Check100 type=checkbox> <tr> <td><input name=ClassIDs type=checkbox value=3132> <td>50</td> </tr>

  • 0

I have the following:

<input name="Check100" type="checkbox">
<tr>
   <td><input name="ClassIDs" type="checkbox" value="3132">
   <td>50</td>
</tr>
<tr>
   <td><input name="ClassIDs" type="checkbox" value="3133">
   <td>100</td>
</tr>

<script>
$('input[name=Check100]').change(function() {
var myChecked = $(this).attr('checked');
$('input:checkbox').attr('checked',myChecked);
});
</script>

But what I need to do is toggle all the inputs that have a 100 in column 2.

  • 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-19T04:10:35+00:00Added an answer on May 19, 2026 at 4:10 am

    I first thought of using :contains() but when I read the documenation i realized that it checks for exactly what it says, if it contains something, not the exact match. I didn’t find any shorthand function for this, but you can use filter().

    For example, :contains(‘100’) will also match 1000.

    Code:

    $('input[name=Check100]').change(function() {
        var myChecked = $(this).attr('checked');
    
        $('td').filter(function() {
            return $(this).text() == "100";
        }).prev('td').find(':checkbox').attr('checked', myChecked);
    });
    

    Example: http://jsfiddle.net/FEP5u/

    Update:

    Enhanced version: http://jsfiddle.net/FEP5u/2/

    Using IDs at your elements and as your selectors improves the speed.
    And the HTML spec says (I think) that attributes like checked should be removed instead of being set to false.

    HTML:

    <input name="Check100" id="Check100" type="checkbox">
    <table id="myTable">
        <tr>
            <td><input name="ClassIDs" type="checkbox" value="3132"></td>
            <td>50</td>
        </tr>
        <tr>
            <td><input name="ClassIDs" type="checkbox" value="3133"></td>
            <td>1000</td>
        </tr>
        <tr>
            <td><input name="ClassIDs" type="checkbox" value="3134"></td>
            <td>100</td>
        </tr>
    </table>
    

    Javascript:

    $(function(){
        $('#Check100').change(function() {
            var $checkbox = $('#myTable td')
                .filter(function() {
                    return $(this).text() == "100";
                }).prev('td').find(':checkbox');
    
            if(this.checked)
                $checkbox.attr('checked', 'checked');
            else
                $checkbox.removeAttr('checked');
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I have an HTML textbox ( <input type=text> )
I have the following input: <node TEXT=txt> <node TEXT=txt> <node TEXT=txt/> <node TEXT=txt/> </node>
I have the following C# which simply replaces parts of the input string that
I have a logical error. I provided the following as input: the salary is
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have following situation. A main table and many other tables linked together with
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

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.