How to make the value of one select box drive the options of a second select box

前端 未结 2 528
萌比男神i
萌比男神i 2020-12-06 20:52

I want to make an HTML form with 2 select boxes. The selected option in the first select box should drive the options in the second select box. I would like to solve this

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 21:28

    You could do plain javascript. If this is all you need javascript for, then jQuery is probably too much.

    create a function in the that populates the second combo box. In the first combo box, you call that function with onChange=theFunctionYouCreated()

    hope that's enough to get you started.

提交回复
热议问题