IT.COM

Comboboxes how to?

Spaceship Spaceship
Watch
Impact
16
hi everyone,

I want to make 2 comboboxes: country and city, but I want the values on city change base on that country user select.

ex: if we select USA then we will see New York but not Tokyo, but if we select Japan then we only see Tokyo, not NY.

How do i do that?


Code:
<select  name="country">
  <option disabled selected>Select</option>
  <option value="us">USA</option>
  <option value="japan">Japan</option>
</select>

<select  name="city">
  <option disabled selected>Select</option>
  <option value="1">New York</option>
  <option value="1">Tokyo</option>
</select>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
That can't be done with HTML alone, so you'll need to use JavaScript. On the first combo box, you can add an onchange event that looks at the selection and populates the second combo box accordingly.
 
0
•••
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back