使用chosen插件实现多级联动和置位

 

首先写好第一个select,加上onchage属性之后,写onchange方法。

<select data-placeholder="选择省份..." class="chosen-select" style="width:150px" tabindex="2" >

<option value="">选择省份</option>

</select>

 

 使用chosen插件实现多级联动和置位

 在网上看很多通过$("#sctCity").trigger("liszt:updated")

来实现更新option。。

在最新的chosen插件中。明确说明通过chosen:updated来实现。

使用chosen插件实现多级联动和置位

 

使用chosen插件实现多级联动和置位

Updating Chosen Dynamically

If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.

$("#form_field").trigger("chosen:updated");



使用chosen插件实现多级联动和置位

重置功能,实在点击之后,选择复位。选择框会自动出现data-placeholder设置的文字。

使用chosen插件实现多级联动和置位

 


 

相关文章:

  • 2022-12-23
  • 2023-02-22
  • 2022-12-23
  • 2021-07-09
  • 2021-12-12
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
相关资源
相似解决方案