Skip to main content | Turn off styling Default page style

Question & Answer index

How to update drop-down based on radio-button selection

In this example, the user is required to select a country before the drop-down box is populated with a list of values.

Please select a country India America Africa Srilanka
Please select a region

How did I do this? By adding an "onclick" event to each radio button that calls a javascript function.

The javascript function does two basic things:

  1. re-sets the "region" drop-down to empty
  2. using the value of the radio button that was clicked, it adds the appropriate values to the drop-down