Mark the use of a small issue encountered by Bootstrap Selectpicker as the next error-checking
$ ('. Selectpicker '). Selectpicker (' Val ', ' mustard ');//Radio
Mark the problem: the Val set must be the value in option, and if it doesn't work with name.
Ps:select Landscaping (Bootstrap)
Files to be introduced:
Bootstrap-combined.min.css
Bootstrap-select.css
Bootstrap-select.js
and several common bootstarp files such as Bootstrap.min.js.
Realize:
1, add class or ID in <select> tag, it is recommended to add class, because class can be repeated;
2, in the JS file to add initialization method:
Initfnc:function () {
$ (". Selectpicker"). Selectpicker ({noneselectedtext: ' Please select '});
}
This method is invoked when external initialization is ok!
The following image is landscaping: not very good-looking, but I feel much better than before!
But this landscaping plugin has several problems:
In fact, not a few, but I think this problem is very tricky, after using this method to beautify, dynamic assignment of <select> will be shown, I think it should be: bootstrap-select.js in the option of <select> Show ' Please enter ' so that the dynamic assignment option will not be written! If you can put noneselectedtext: ' Please choose ' to fix, then this problem should be able to solve!
After a few hours of research, found the problem, but only to solve one of them;
When calling in JS, be sure to wait for the option on the face to be loaded and then adjust
Initfnc:function () {
$ (". Selectpicker"). Selectpicker ({noneselectedtext: ' Please select '});
}
This will also beautify the dynamic select assignment. But there is still a problem: Not every select on the page can be loaded when the page is initialized, for example: Now there are two simultaneous select, the option of the second select to change with the first , add the monitor onchange or change in JS, if this beautification has the question!
The above is a small set to introduce the bootstrap selectpicker of the relevant knowledge, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!