How to dynamically filter a select2 listing based on option class

后端 未结 2 1896
时光说笑
时光说笑 2020-12-21 15:48

I have a dropdown select of optional \'opportunities\' (id=\"opportunities\" in the example below) which I enhance using the select2 jquery plugin, and wish to

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 16:28

    I managed to solve this using 2 optional functionality provided by the select2 plugin, namely the ability to control the way items are built and displayed using the templating functionality, and using the programmatic control exposed in the plugin. I replaced the javascript appended below the example in the question with,

    
    
    

    I have also added an empty