1. Home
  2. Computing & Technology
  3. JavaScript

Linked Dropdowns

Part 1 : Introduction and Sample Page

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

The Script

Do you have multiple dropdown lists in one of your forms? Is the value that is selected in one dropdown dependent on the value selected in a second dropdown?

A simple Javascript function can link two drop down lists together so that selecting a particular value in one list will automatically select the same value in a second list.

Here's an example. You can select whatever entry you like in the "Real" dropdown and it will have no effect on the "Estimate" dropdown. That's what you would expect anyway. If you select any of the options in the "Estimate" dropdown other than the blank entry at the top the "Real" dropdown entry will be automatically changed to the same entry.

Real: Estimate:

If that is how you need to link two of your drop down lists together then learn how to link them by examining the code that I used for this example.

Introduction | The Script
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.