I have a bootstrap multiselect html element that I populate with data from a web service call that gets a list of regions in New Zealand. I need to load these options into <select>and not select the top default option.
I tried everything that was done using the built-in functions inline functions and bootstrap multiselect options . Nothing will work out. Therefore, I resort to javascript vanilla or javascript vanilla to go directly to normal html and deselect the first option.
All work on this can be done in this jsfiddle
I had to copy the nested mini-resource (xml2json.min.js) to the top of the javascript editor because it did not play well when I tried to add it as an external resource.
I tried this:
$("ul.multiselect-container").find("li").removeClass("active");
And it does not work. It removes the active class, but does not deselect. How to deselect?
I tried this:
$("ul.multiselect-container").find('input[type="radio":checked]').prop('checked', false);
He does not cancel the choice.
See if you can deselect the top selection option.
So the jsfiddle in the url, the same as above but ending in 182, is my refactoring to try to make people easier to understand, but it did not work correctly on my laptop for friends.
When using the plugin as <select multiple=true>it does not select the top option by default. However, I need the same behavior with normal<select>