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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:45:02+00:00 2026-05-25T10:45:02+00:00

I think my JQuery knowledge is a little lacking. On my page I have

  • 0

I think my JQuery knowledge is a little lacking.

On my page I have 0 or more hidden variables that look like this.

<input type='hidden' class='defaultTickedStatus' value='INACTIVE' />
<input type='hidden' class='defaultTickedStatus' value='ACTIVE' />

They can be accessed via the selector $(“.defaultTickedStatus”)

I also have a number of checkboxes in an element like this

<div id="checkboxes">
<input type="checkbox" value="INACTIVE" id="checkbox1" tabindex="30430">
<input type="checkbox" value="ACTIVE" id="checkbox1" tabindex="30430">
<input type="checkbox" value="SUBMITTED" id="checkbox1" tabindex="30430">
<input type="checkbox" value="FINALISED" id="checkbox1" tabindex="30430">
...
</div>

They can be accessed via the selector $(“#checkboxes input”)

What I would like to do is when the user clicks a button, I want it go through all of the checkboxes and for the ones that have a value which equals one of the values in the hidden tags, then to check it.

However, being a little unfamiliar with JQuery, I’m unfamiliar with how to accomplish this. This is what I have so far…

    $("#checkboxes input").each(function (index, Element)
    {
        $(".defaultTickedStatus").each(function (i2, status)
        {
            if (status.value == Element.value)
            {
                $(status).selected(true);
            }

        });

    });

It’s getting to the $(status).selected(true) part but for some reason, it does not seem to work. Also, I’m positive there is a much easier way to do this through Jquery.

Wonder if anyone can help me.

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-25T10:45:02+00:00Added an answer on May 25, 2026 at 10:45 am

    Be carefull, you can’t have 4 times id="checkbox1". Also, there is no need to have 2 nested .each(function() if you use the selector input[value="foo"]

    Here is how you can do it:

    $("#clickme").click(function() {
        $(".defaultTickedStatus").each(function() {
            var value = $(this).attr('value');
            $('#checkboxes input[value="'+value+'"]').attr('checked','checked');
        });
    });
    

    working jsFiddle

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

Sidebar

Related Questions

First off, I don't have any knowledge about java/jquery/ajax or such, but I think
Well, this issue is making me mad. I think that I have a lack
OK I think I get Difference between jQuery.extend and jQuery.fn.extend? in that the general
Here's a little jQuery function that does what I want when a checkbox is
I have been dabbling around this morning trying to modify the jQuery cycle script
I have a dictionary list of about 58040 words and i don't think jquery
I have an iframe on a web page that is on the opening page
I have a form with a bunch of checkboxes, and a hidden field that
I have an ASP.NET dropdownlist like this: <asp:DropDownList ID=ddlMyDropDown runat=server> <asp:ListItem>Please pick one</asp:ListItem> <asp:ListItem>option1</asp:ListItem>
Do you think jquery could help me get the following script work faster? Thanks!

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.