I have two <select> elements. The first one contains countries (e.g. USA, Canada, England, Russia, Poland…) and the second one is hidden, containing cities from only USA and Canada (e.g. New York, Los Angeles, Chicago… OR Ottawa, Vancouver, Surrey…)
If the user selects Canada or USA from the first <select>, the second should show and
allow him to select his city.
Is it possible to do? I visited so many websites with Ajax and JQuery Validation forms and didn’t find some similar source to make this.
Thank you.
Listen to the change event for the select list. In the change event, if the selected value is “USA” or “Canada” then show the other select list, otherwise hide it.
See an example.
Assuming the select structure looks like this:
Listen to the change event on the countries array.