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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:49:25+00:00 2026-05-28T05:49:25+00:00

New to jquery question… Using jQuery, depending on the radio button clicked I would

  • 0

New to jquery question…

Using jQuery, depending on the radio button clicked I would like jQuery auto ‘check’ the corresponding checkbox.

<input type="radio" value="#ID#" name="#ID#1" 
       onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#" 
       name="sessionsThatNeedBookingOnto" class="#ID#1"/>

<input type="radio" value="#ID#" name="#ID#1" 
       onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#" 
       name="sessionsThatNeedBookingOnto" class="#ID#1"/>

<input type="radio" value="#ID#" name="#ID#2" 
       onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#" 
       name="sessionsThatNeedBookingOnto" class="#ID#2"/>

This is what I have tried but my understanding is a little off…

<script>
    function tickSession(elementHere){
            alert($(elementHere).val());
            $(elementHere).attr('id').attr("checked", "true");
            $($(elementHere).val()).attr('checked','checked')

    }
  </script>
  • 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-28T05:49:26+00:00Added an answer on May 28, 2026 at 5:49 am

    Let’s rework your checkboxes/radios:

    <input type="radio" value="#ID#" name="rd1" class='rd-session-control'/>
    <input type="checkbox" value="#ID#" id="for-rd1" 
        name="sessionsThatNeedBookingOnto" class="#ID#1"/>
    

    Now:

    $(function() {
        $('.rd-session-control').click(function() {
            var checkbox = $('#for-' + $(this).attr('id'));
            if (checkbox.is(':checked'))
                checkbox.removeAttr('checked');
            else
                checkbox.attr('checked', 'checked');
        });
    });
    

    What this does is:

    1. Allow you to set all of the click handlers for the radios at once using a class rd-session-control.
    2. The ID attribute for the checkboxes is sane and easily calculated relative to the radio that controls them.
    3. Uses the :checked selector to test if the checkbox is active or not.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry, I am still new using jquery so this might be an easy question.
I am new to jQuery and so don't mind this question if it sounds
I'm new to jquery, and sorry if this question is asked before (could find
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
I have a jQuery question: I have an ADD button that adds text to
I'm new with jquery and want to ask a question, can jquery make something
I am new to JQuery, so this may be a stupid question, however I
I'm new to jQuery, apologies if this is a silly question. When I use
I'm new to JQuery and so far I'm using prototype. But now I want
So I am pretty new to jQuery and Javascript in Gen. I like the

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.