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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:23:46+00:00 2026-06-03T09:23:46+00:00

I’m working on a page redesign, and I’ve added 6 different buttons for the

  • 0

I’m working on a page redesign, and I’ve added 6 different buttons for the 6 options a user can choose instead of 6 radio boxes & 1 button. I just need to adjust the code to make sure that on the next page, the right total and text is displayed based on what button is pushed.

I just need some of the text on the next page to change depending on which of the buttons is pressed.

Here is what was there originally:

<input id="diamondmonthly" class="radio" type="radio" value="diamondmonthly" name="membership">

<input id="diamondyearly" class="radio" type="radio" checked="checked" value="diamondyearly" name="membership">

<input id="c4" class="radio" type="radio" value="c4" name="membership">

<input id="c3" class="radio" type="radio" value="c3" name="membership">

<input id="c2" class="radio" type="radio" value="c2" name="membership">

<input id="c1" class="radio" type="radio" value="c1" name="membership">

<a id="btnSave" class="xlarge button-submit" onclick="$j('#btnSave').attr('disabled', 'disabled');qc.recordControlModification('btnSave', 'Enabled', '0'); qc.pB('MembershipForm', 'btnSave', 'QClickEvent', '');" href="#">

<script>
//<![CDATA[
qc.registerForm(); qc.imageAssets = "http://images.comfiles.com/assets/images"; qc.cssAssets = "http://images.comfiles.com/assets/css"; qc.phpAssets = "/assets/php"; qc.jsAssets = "http://images.comfiles.com/assets/js"; qc.regCA(new Array("btnSave","btnSave2","c1","c2","c3","c4","diamondyearly","diamondmonthly")); jQuery(document).ready(function($j){if($j.isFunction($j().tooltip)){$j("#MembershipForm :input[data-error]").tooltip({ position: "center right", tipClass: "error_tooltip", offset: [0, -4] })}}); 
//]]>
</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-06-03T09:23:47+00:00Added an answer on June 3, 2026 at 9:23 am

    This can be dealt with using a listener one each button, or by delegating the work to a single ancestor element. In this case, it’s probably easiest to put a single click listener on the form. When it’s called, you can use the associated event object to see where it came from and react accordingly.

    Note that when getting form controls by name, if only a single control has that name then only a single element is returned. If two or more controls have the name, then a HTMLCollection of the elements with that name is returned.

    The listener can be something like:

    <form onclick="handleClick(this)" ...>
    

    And the listener (untested but you should be able to get it going from here):

    function handleClick(form) {
      var button, buttons = form['membership'];
    
      // Now show text depending on which membership button is checked
      for (var i=0, iLen=buttons.length, i<iLen; i++) {
          button = buttons[i];
    
          // Assuming that the text element to display has an ID 
          // matching the value of the checked button
          if (button.checked) {
            document.getElementById(button.value).style.display = '';
          } else {
            document.getElementById(button.value).style.display = 'none';
          }
      }
    }
    

    The script will run every time there is a click anywhere in the form, so the right text will always be displayed, even if the reset button is clicked.

    The if..else can be replaced by:

          document.getElementById(button.value).style.display = button.checked? '' : 'none';
    

    but the longer version may be clearer.

    Oh, and get rid of the CDATA delimiters in the script element, they are only required for documents that are served as XML.

    • 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 have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string
I'm making a simple page using Google Maps API 3. My first. One marker
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.