Jump to content

Select- how to


dimitar

Recommended Posts

I want to add two <select> fields, and i want if some option from first selsect is chosen other options to be showed in second.For ex. i have one select with option countries. and when i choose some opttion from the country select(for example U.K) in the second select the options to be citys from that country(for example London etc), and if i choose (Spain) in the second <select> to be displayed other options for example madrid, barcelona etc.

Link to comment
Share on other sites

It's a little complicated, you have to have the list of the cities for each country stored somewhere (a database or XML file). When you change the select option, you have to use javascript to get the list of cities for the selected country and append <option> nodes to the other <select>. Making the full code would take me a little while, so I'm not going to do it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...