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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:16:32+00:00 2026-05-26T02:16:32+00:00

I have a form with 3 inputs: name email company I also have two

  • 0

I have a form with 3 inputs:

  • name
  • email
  • company

I also have two radio buttons a user must select from:

  • A
  • B

If the user selects A, leave the form fields as they are. If the user selects B then change the descriptions of the input fields.

By default the form loads as A.

name = we want your (name), company = we want your (company), email = we want your (email)

How do I get the changed radio button value to update the text input fields?

  • 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-26T02:16:33+00:00Added an answer on May 26, 2026 at 2:16 am

    I’ve set up a jsfiddle as an example for this trick.
    What you want to do is make the normal form, with two radio buttons, and bind the onChange event to them so whenever you click a radio button it triggers a check to see which radio button was clicked, and make changes to the form/mark-up around it.

    example JS:

    $(document).ready(function(){
    $("input[name='option']").live("change", function(){
        if ($(this).val() == "A") {
             $("input.first-input").attr("name", "name");
             $("input.first-input").siblings("span").text("name:");  
             $("input.second-input").attr("name", "company");
             $("input.second-input").siblings("span").text("company:");  
             $("input.third-input").attr("name", "email");
             $("input.third-input").siblings("span").text("email:");                   
        }
        else if ($(this).val() == "B") {
             $("input.first-input").attr("name", "color");
             $("input.first-input").siblings("span").text("color:");  
             $("input.second-input").attr("name", "width");
             $("input.second-input").siblings("span").text("width:");  
             $("input.third-input").attr("name", "height");
             $("input.third-input").siblings("span").text("height:");              
        }
    }); 
    

    });

    test HTML:

    <input type="radio" name="option" value="A" checked="checked" /> A -- <input type="radio" name="option" value="B" /> B
    <br />
    <br />
    <label><span>name:</span> <input type="text" name="name" class="first-input" /></label><br />
    <label><span>company:</span> <input type="text" name="company" class="second-input" /></label><br />
    <label><span>email:</span> <input type="text" name="email" class="third-input" /></label><br />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did a simple rails form with two user inputs , name and email.
I have a form with 2 text inputs and 2 radio buttons, as below:
I have a login form that has Username and password as inputs from user
I have a simple form with basic info e.g. <label>*Name:</label> [inputbox] <label>*email:</label> [inputbox] <label>Company:</label>
I have a form which collects user info including name, location, url, email address
I have a form that takes the following inputs: Name: IBM Surface(in m^2): 9
I have a form with two text_fields: <input type=text id=post_name name=post[name] /> <input type=text
I have a form on a page where the user has inputs to edit
I have a contact form in my flash file with name/email/message fields which a
I have following form. <form action= method=post id=save-user> <button type=button name=save-user>Save</button> <button type=button name=save-user-close>Save

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.