As shown in the picture: Just this kind of second-level linkage, I am looking for ideas... I don’t know how to write... It was developed using bootstrap and jquery.
There are two drop-down menus, but the drop-down menus in bootstrap are used without select and option tags.
Waiting online...Urgent! ! !
Use p to simulate option
Post the code. I can’t find the specific data structure here. Anyway, it’s just to get the data through ajax with more IDs. It’s very simple
The idea is not difficult. The most important thing is to monitor changes in the first-level list (here you can monitor the click event of the list), and then dynamically change the content of the second-level list (if it is not complicated, just use string splicing, otherwise use a template engine). As for the content data, all the data can be obtained in advance or on demand.
This should have a reasonable json format, such as the following. It can also be nested. Anyway, there will be a parsing rule, and then your data will be rendered. It is no different from rendering a table. If compatibility is not considered, you can use the attribute selector to complete it, which is super fast.
Generating data for the first-level province:
js gets the value of the user clicking on the first-level province (#province):
It’s roughly like this. There’s a big-breasted brother who wrote it very clearly above.