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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:21:59+00:00 2026-06-17T09:21:59+00:00

Im trying to get a dynamic update of my select list depending on what

  • 0

Im trying to get a dynamic update of my select list depending on what radio button is checked.

I have 3 files:

maleweight.html:

<option value="blank"></option> 
<option value="Pluma -64.0 kg">Pluma -64.0 kg</option>
<option value="Pena -70.0 kg">Pena -70.0 kg</option>
<option value="Leve - 76.0 kg">Leve - 76.0 kg</option>
<option value="Médio -82.3 kg">Médio -82.3 kg</option>
<option value="Meio-Pesado -88.3 kg">Meio-Pesado -88.3 kg</option>      
<option value="Pesado -94.3 kg">Pesado -94.3 kg</option>        
<option value="Super Pesado -100.5 kg">Super Pesado -100.5 kg</option>      
<option value="Pesadíssimo +100.5 kg">Pesadíssimo +100.5 kg</option>

femaleweight.html:

<option value="blank"></option> 
<option value="Rooster -48.5 kg">Rooster -48.5 kg</option>
<option value="Super Feather -53.5 kg">Super Feather -53.5 kg</option>
<option value="Feather -58.5 kg">Feather -58.5 kg</option>
<option value="Light - 64.0 kg">Light - 64.0 kg</option>
<option value="Middle -69.0 kg">Middle -69.0 kg</option>
<option value="Medium Heavy -74.0 kg">Medium Heavy -74.0 kg</option>        
<option value="Heavy -79.3 kg">Heavy -79.3 kg</option>      
<option value="Super Heavy -84.3 kg">Super Heavy -84.3 kg</option>      
<option value="S. Super Heavy +84.3 kg">S. Super Heavy +84.3 kg</option>

newuser.php:

    <tr>
    <td><b>K&oslash;n:</b></td>

    <td><input type="radio" name="Mand" value="Mand" id="male" onclick="update()">Mand
    <input type="radio" name="Kvinde" value="Kvinde" id="female" onclick="update()">Kvinde</td>
    </tr>

    <tr>
    <td><b>V&aelig;gt:</b></td>
    <td><select id="weight" name="vægt" id="selectv">               
    <script language="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js">

        function update() {

            if (document.getElementById('male').checked) {
                $("#weight").load("maleweight.html");
            }

            else if (document.getElementById('female').checked) {
                $("#weight").load("femaleweight.html");
            }
        }

    </script>
    </select></td>
    </tr>   

I have 2 problems:

  1. The radio buttons seem broken, i can choose both at the same time and i can not “uncheck” them. – Maybe because of the script not workind properly?
  2. When i click either of the radio buttons the select list is not updated.

I have tried:

  • Including (just naming the file ex: maleweight.php).
  • Javascript (could not make it work).
  • .get instead of load.
  • Tried .checked == true
  • Tried different solutions (not for the exactly same) listed here on SO.

Niether of them will work for me. What am i missing?

Thanks in advance!

Best regards,
Casper

EDIT:

The page where everything is going down: http://www.casperwmn.dk/tiljonas/nyprofil.php

  • 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-17T09:22:00+00:00Added an answer on June 17, 2026 at 9:22 am

    I see a few obvious problems with your code.

    1. You should use the same name for both radio buttons, if you want to make sure only of one them can be selected.
    2. You shouldn’t put the JavaScript within your select-element. As soon as the the first .load() method completes, it will remove the entire JavaScript as it replaces the content of your select-element. I’m also fairly certain that it is invalid HTML to do so (a <select> element can only have <option> elements as children).
    3. You cannot both load an external JavaScript-file and write your own JavaScript with the same <script> tag, you will have to have two separate <script> tags – one for loading the jQuery source, and one for writing your own JavaScript.
    4. Your <select> element has two ID attributes, which isn’t valid HTML. Remove one of them, and use the one you keep as the selector in your JavaScript.
    5. <script language="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js">
      is not the right way to load a JavaScript. Instead of language="text/javascript" it should be type="text/javascript", but you could just as well get rid of the attribute all together, as JavaScript is the default language for the <script> element.

    Since you are using jQuery to load the content, why not use it for the complete solution? If you change the name of your radio-buttons to say gender, and the values to male/female, and remove the inline onlick-attribute. Then you could do it all with a small piece of jQuery.

    $(function() {
       $("input[name='gender']").on("click", function() {
            var gender = $(this).val();
            $("#weight").load(gender + "weight.html");
       });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report where I'm trying to get the sum of a dynamic
In this page there's a way to dynamic add html (textbox,input button and radio
I am trying to get dynamic select menu's working in my Rails application. I
EDIT: Database names have been modified for simplicity I'm trying to get some dynamic
I've a crystal report that I'm trying to get a dynamic image displayed. This
I'm trying to make a dynamic array in C# but I get an annoying
I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
I'm trying to dynamically update a table of values using SocketStream. I have a
I have a small function that takes a dynamic list of textboxes with urls

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.