This article mainly shares with you the js implementation of the three-level linkage plug-in of provinces and municipalities. I hope this article can help everyone better understand the implementation method of the three-level linkage plug-in of provinces and municipalities.
// 页面上先引入css与js文件 <p id="wrap"></p>
There are no restrictions on the container tags in the page, just give an ID
var address = new Address({ wrapId: 'wrap', showArr: ['provinces','citys','areas'], beforeCreat:function(){ console.log("beforeCreat") }, afterCreat:function(){ console.log('afterCreat'); } })
##wrapId: "wrap" // The wrap here is the above Container id
showArr: ['provinces','citys','areas'] // This represents the id of the province, city, and district container respectively.
['provinces','citys','areas']has a length of 3, then there will be Provinces and cities, the three strings in the array are the ids of the province, city, and district containers respectively
For example, the passed array
['provinces', 'citys']
The length is 2, then the province and city will appear. The two strings in the array are the ids of the province and city containers
If the array length is 1, we won’t say it.
Callback executed before the plug-in starts to create Function
Callback function executed after the plug-in is created
Related recommendations:
WeChat small Program about how to use the three-level linkage selector
jQuery three-level linkage effect implementation methodjQuery uses EasyUi to achieve three-level linkage Sharing examples of drop-down box effectsThe above is the detailed content of js realizes the sharing of three-level linkage plug-ins in provinces and municipalities. For more information, please follow other related articles on the PHP Chinese website!