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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:07:32+00:00 2026-06-02T16:07:32+00:00

I’m still new to Javascript and Jquery and am having a little trouble with

  • 0

I’m still new to Javascript and Jquery and am having a little trouble with this one.

I want to be able to pass a value from a fieldset (#a) with a select option to another fieldset (#b) with checkbox options. For example, the fieldset #a has default options 1,2,3,4,5. Fieldset #b can have many more options but must at least include the default from #a.

code snippet for fieldset #a:

      <fieldset id="a">
        <legend><span>Default Option</span></legend>  
        <div class="fieldset_wrapper">
          <select name="form_default">
            <option value="">Select One</option>
            <%=returnValueMap.get("defaultOptionSelect")%>

          </select>
        </div>
      </fieldset>

code snippet for fieldset #b:

         <fieldset id="b">
         <legend><span>Option</span></legend>
            <div class="fieldset_wrapper">
              <div><input type="checkbox" name="select-all" id="select-all" class="checkAll"/>   All Options</div>

        <%=returnValueMap.get("optionSelect")%>

        </div>
      </fieldset>

Edit, here is something I tried but I think I’m obviously missing something. Again, i’m trying to learn this stuff

    $('#a option[name="form_default"]:selected').each(function(){   
                            $('#b input[type="checkbox"]').eq($(this).index()).prop('checked',true);
    });
  • 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-02T16:07:32+00:00Added an answer on June 2, 2026 at 4:07 pm
    $('#a select').on('change', function(e){
      e.preventDefault()
      $('#b input[type="checkbox"][value="'+$(this).val()+'"]').prop("checked",true);  
    })
    

    Little explanations:

    • Spy for changes and call the function on changes $('#a select').on('change', function(e){
    • You don’t really need that here, usually it’s to remove the default behavior, for example it prevents changing page on links: e.preventDefault()
    • We take the selected value in the select box: $(this).val()
    • We select the corresponding checkbox using the Type, and the Value, like: #b input[type="checkbox"][value="value selected in select box"]
    • Check the checkbox: .prop("checked",true)

    may help you

    EDIT: And if you want the default selected option go to b at the page load:

    jQuery(function($){
      $('#b input[type="checkbox"][value="'+$('#a select').val()+'"]').prop("checked",true);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but

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.