How can I dynamically change the items in a select?

I am interested in helping the user narrow down his choices as he fills out additional information. A common way to do this is through a series of selects, where each time time the user chooses an item from a select, the next select appears below the previous select with relevant and more detailed choices.


  1. select from: {car, bus, train, plane, bike}
  2. user selects plane
  3. select from: {first class, business class, economy class}
  4. user selects business class

Is there a way to programmatically populate a select with choices that are based on a previous selection?