SoFunction
Updated on 2025-03-01

Controlling select attribute changes through BootStrap-select plugin js jQuery

I think everyone is familiar with bootstrap-select. It is a plug-in with a front-end drop-down box that is very useful. Setting properties in the select tag can do a lot of functional control. However, after initialization, it is not a single one of them. I have studied it for a long time and found it. Of course, some people will kill and regenerate it too low. I decided to fill this gap.

JS controls the change of select attributes, which is actually very simple and does not require

$('#goodsNames').selectpicker('render');
$('#goodsNames').selectpicker('refresh');

Re-rendering only

$(".selectpicker").selectpicker({
width : 300,
actionsBox:true, // Add all and unchecked buttons in the drop-down optioncountSelectedText:"Selected{0}item",
selectedTextFormat:"count > 5",
multiple:"true",
maxOptions="2"
})

Smart people have seen that this is the setting. It is worth noting that properties like multiple can be directly assigned TRUE or FALSE to control. For properties like data-max-options, remove data and use camel name.

The above is what the editor introduced to you to control the change of select attributes through the BootStrap-select plug-in js jQuery. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!