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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:59:35+00:00 2026-06-16T01:59:35+00:00

What I am trying to do with jQuery is make it so that I

  • 0

What I am trying to do with jQuery is make it so that I can use three radio buttons in the same group with each other. When one is selected the other two shouldn’t be active. I want to be able to display separate blocks of HTML in the end result with the jQuery, but I can’t get something simple to run right with what I am working with.

Here is the code that I have to work with at the moment:

    $(document.ready(function()
{
    $("input[name='rdiobut']").change(function(){
        if ($("input['rdiobut']:checked".val() == 'a'))
        $("#rdiocont").text("There is no expiration date.");
        else if ($("input[name='rdiobut']:checked".val() == 'b'))
        $("#rdiocont").text("Tell me how many days until expire");
        else ($("input[name='rdiobut']:checked".val() == 'c'))
        $("#rdiocont").text("Pick the date to expire from a calendar");
    });
});

Here is the table that the jQuery goes to:

<tr><td>Expire Settings:</td><td>Does Not Expire: <input type="radio" name="rdiobut" value="a" checked="check" /> &nbsp;&nbsp;&nbsp;<strong>OR</strong> Expires By Days <input type="radio" name="rdiobut" value="b" /> &nbsp;&nbsp;&nbsp;<strong>OR</strong> Select a Date to Expire On <input type="radio" name="rdiobut" value="c" /></td></tr><tr id="rdiocont"><td>No Expiration Date</td></tr><tr id="rdiocont"><td>Expires by Days</td></tr><tr id="rdiocont"><td>Choose Expiration by Calendar</td></tr>

Does anyone have any advice or thoughts on what I may be doing wrong?

  • 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-16T01:59:36+00:00Added an answer on June 16, 2026 at 1:59 am

    Ok, you had some errors in your code. Here you have it, all cleaned up and working like I think you want it (working example):

    jQuery

    $(document).ready(function()
    {
        $("input[name='rdiobut']").change(function(){
            if ($("input[name='rdiobut']:checked").val() == 'a')
                $("#rdiocont").text("There is no expiration date.");
            else if ($("input[name='rdiobut']:checked").val() == 'b')
                $("#rdiocont").text("Tell me how many days until expire");
            else if ($("input[name='rdiobut']:checked").val() == 'c')
                $("#rdiocont").text("Pick the date to expire from a calendar");
        });
    });
    

    HTML

    <table>
        <tr>
            <td>Expire Settings:</td>
    
            <td>
                Does Not Expire: 
                <input type="radio" name="rdiobut" value="a" checked="checked" /> &nbsp;&nbsp;&nbsp;
                <strong>OR</strong> 
                Expires By Days 
                <input type="radio" name="rdiobut" value="b" /> &nbsp;&nbsp;&nbsp;
                <strong>OR</strong> 
                Select a Date to Expire On 
                <input type="radio" name="rdiobut" value="c" />
            </td>
        </tr>
    
        <tr id="rdiocont">
            <td>(Select an option)</td>
        </tr>
    
    </table>
    

    Some notes:

    • Don’t use the same id for various elements (like you used in <tr id="rdiocont">);
    • It is $(document).ready, not $(document.ready – watch for the closing )
    • Like @Ryan said, don’t evaluate an expression in the else statement. If you really want to evaluate the expression, continue to use else if (it’s not mandatory to have an else statement).
    • On your first evaluation, it’s input[name='rdiobut'] and not input['rdiobut']. You also didn’t close the ) after :checked"
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a jquery menu that when I click on one
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I have been trying to make this to be a little jQuery plugin that
In an ASP.NET MVC3 application, I'm trying to use jQuery to make an asynchronous
I'm trying to use jQuery to make a slightly more sophisticated page refresh. With
I've been trying to use jquery to trigger a click. I've discovered that triggered
I'm trying to make a jQuery script that will hide all the visible elements
I'm trying to use jQuery to make an input field have different CSS when
I'm trying to use jQuery UI's sortable to make list items in a browser
I've been trying to make a multi-page poll with jQuery Mobile that is supposed

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.