javascript - How to add option values on silviomoreto's Bootstrap-Select -
I have used bootloader selection of Schalmomerato but I have problems I have 2 dropdowns (select) an area dropdown And cities are now, I have a jquery onchange function, the functions will change the values in the dropdown of cities based on the selected area. Here's my code:
& lt; Id = "area" category = "select" & gt; & Lt; / Select & gt; & Lt; Select ID = "Cities" category = "Selected Picker" & gt; & Lt; / Select & gt; $ ("Change", Function () {$ ("# Cities"). Html ('& lt; Option & gt; City 1 & lt; / option & gt; & lt; Option & Gt; city 2 & lt; / option & gt; ';)); The problem do I find compatibility? When I removed the class "selectpicker" it works fine, but I can not remove it because I used it for my dropdown UI. I checked the documentation here but I could not find the relevant answer to my question. Thanks!
Try selectpicker ('refresh') . or manipulation to update the program with JavaScript, the first selection, then Refresh method to update the UI to match the new state Use Ex> $ ( "# cities") .html ( '& lt; base & gt; city 1 & lt; / option & gt; & lt; base & gt; city 2 & lt; / option & gt;'). Selector ('refresh'); Work demo:
Comments
Post a Comment