countrypicker.js是一款jquery选择国家下拉列表框插件。countrypicker.js带有搜索功能和显示国旗功能。通过简单的设置,既可以生成带既定国家的下拉列表框。
使用方法
在页面中引入jquery和bootstrap相关文件,以及bootstrap-select相关文件和countrypicker.js文件。
HTML结构
使用一个元素来作为该国家选择下拉列表框的HTML结构即可。
注意必须带上class类selectpicker countrypicker。
如果需要下拉列表框带有搜索功能,可以添加data-live-search属性。
data-live-search="true">
如果需要显示国旗,可以添加data-flag属性。
data-live-search="true"
data-flag="true">
你还可以通过data-default属性来设置默认选择的国家。
data-live-search="true"
data-default="China"
data-flag="true">
countrypicker.js jquery选择国家下拉列表框插件的github地址为:https://github.com/Saganic/country-picker