bootstrap-combobox
bootstrap-combobox copied to clipboard
Set default value
How can i set default value of the combo box.
I am using asp and want to set the comboxi according the a hidden field $('.ComboBox').val(document.getElementById('<%#Me.hdnHostName.ClientID%>').value);
But I am unable to refresh the combo based on this value.
I have tried $('.ComboBox').refresh; to no avail
Thank you for some help
I would really like to know how to do this as well.
Please try: $(".ComboBox").data('combobox').refresh();
if($("option[value='"+selectVal+"']",this.ui.select).length > 0){
this.ui.select.val(selectVal);
this.ui.select.data("combobox").refresh();
this.ui.select.data("combobox").triggerChange();
}
Thanks @KevinPan.
I had something listening for selection and calling triggerChange() triggered the event for me. this.ui.select is my jQuery element for my select element. If statement checks the option exists.