Home  >  Article  >  Web Front-end  >  js realizes the sharing of three-level linkage plug-ins in provinces and municipalities

js realizes the sharing of three-level linkage plug-ins in provinces and municipalities

小云云
小云云Original
2018-02-12 15:50:412062browse

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.

    For example: If the passed array
    ['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

    js realizes the sharing of three-level linkage plug-ins in provinces and municipalities

    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

    js realizes the sharing of three-level linkage plug-ins in provinces and municipalities

    If the array length is 1, we won’t say it.

  • ##beforeCreat

    Callback executed before the plug-in starts to create Function

  • afterCreat

    Callback function executed after the plug-in is created

    js realizes the sharing of three-level linkage plug-ins in provinces and municipalities
  • Preview

js realizes the sharing of three-level linkage plug-ins in provinces and municipalities

Related recommendations:

WeChat small Program about how to use the three-level linkage selector

jQuery three-level linkage effect implementation method

jQuery uses EasyUi to achieve three-level linkage Sharing examples of drop-down box effects

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn