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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:37:23+00:00 2026-05-24T12:37:23+00:00

I have a select tag, where users can select what TYPE of exposure they

  • 0

I have a select tag, where users can select what TYPE of exposure they want for their clicks:

 <select name="exposure">
                        <?php while($a = mysql_fetch_assoc($r)):  ?>
                            <option value=""><?php echo $a['exposure']; ?></value>
                        <?php endwhile; ?>
                        </select>

Below that, I have another select tag, that will show the clicks with value taken from whatever exposure type they chose:

<select name="clicks">
                        <?php while($a = mysql_fetch_assoc($r)):  ?>
                            <option value=""><?php echo $a['amount']; ?></value>
                        <?php endwhile; ?>
                        </select>

My question is: How can I change the value in the second select tag, according to whatever the user has chosen in the first?

  • 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-24T12:37:23+00:00Added an answer on May 24, 2026 at 12:37 pm

    This shouldn’t be too difficult. All you really need is a mapping between ‘exposure’ values and ‘clicks’ values, and some way to turn the ‘clicks’ values into valid markup. You can play around with the example below on jsFiddle: http://jsfiddle.net/ninjascript/5QPq5/

    /**
     * Here's a map of possible values from 'exposure' and
     * related values for 'clicks'.
     */
    var map = {
        "OptionA": ['A001','A002','A003'],
        "OptionB": ['B001','B002','B003']  
    };
    
    /** 
     * A quick and dirty method to turn some values in the map
     * into a set of <option> tags.
     */
    function create(key)
    {
        var result = [];
        if (map.hasOwnProperty(key)) {
            for (var i = 0; i < map[key].length; i++) {
                result.push('<option value="'+map[key][i]+'">');
                result.push(map[key][i]);
                result.push('</option>');
            }
        }
        return result.join('');
    }
    
    /**
     * Use jQuery to handle every 'change' event and add a new
     * set of <option> elements to the 'clicks' element.
     */
    $('select[name="exposure"]').live('change', function()
    {   
        var options = create(this.value);
        $('select[name="clicks"]').html(options);
        $('div').html('<span>foo</span>'); // <-- Update some other element too
    });
    

    Edit: jQuery.live() will execute a function whenever an event occurs. You can do whatever you want within that function, including change the contents of multiple DOM elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select html tag, and I want the background-color of the option
I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have a easy select tag: <select> <option></option> <option></option> </select> Then I want use
Summary: I have passed the name of the id select tag into an Array.
In the settings.php i have some input for the realname,hobby,city and select tag for
I have table Users which contains columns: id, name, points, extra_points. How can I
i have a form tag and users can dynamically create the form by clicking
Suppose I have a dropdown (select tag) with 3 values. Our first option has
I have a problem with adding OPTIONS to SELECT tag dynamically. Here is my
I have the following SQL: SELECT * FROM [Database].dbo.[TagsPerItem] INNER JOIN [Database].dbo.[Tag] ON [Tag].Id

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.