<link rel="stylesheet" type="text/css" href="jquery.xcity.min.css"> <script src="jquery.xcity.min.js"></script> <script src="jquery.easyui.citybox.js"></script>
<input class="easyui-citybox" data-options="url: '/data-city-list2.json'"> <input class="easyui-citybox" data-options="label:'城市:', url: '/data-city-list2.json'"> <input class="easyui-citybox" data-options="label:'城市:', url: '/data-city-list2.json', value: 'anyang,beijing', text:'安阳,北京'"> // getData $(selector).citybox('getData'); $(selector).citybox('getData', function(data) { console.log(data); }); // clearData $(selector).citybox('clearData'); // setData $(selector).citybox('setData', {value: 'beijing', text: '北京'}) $(selector).citybox('setData', ['beijing', '北京']); // getValue $(selector).citybox('getValue'); // getText $(selector).citybox('getText'); // setValue $(selector).citybox('setValue', 'anyang,beijing'); // setText $(selector).citybox('setText', '安阳,北京'); // config 1 $(selector).citybox({url: '/data-city-list2.json'}); // config 2 $(selector).citybox({ url: '/data-city-list2.json', // api value: 'anyang,beijing', // initial value text:'安阳,北京' // initial text }); // config 3 $(selector).citybox({ cache: true, // cache api data separator: ',', groupSize: 3, multiple: 0, // unlimited of selected item 0 | 1 ~ 9999... url: '/data-city-list2.json', // api value: 'anyang,beijing', // initial value text:'安阳,北京' // initial text, change: function(data) { console.log(data); } });