I'm using jQuery UI autocomplete combobox widget. When i add placeholders on my comboboxes, the autocomplete boxes are opened by default.
This occurs only on IE10 and later.
This is my code :
_create: function () {
this.wrapper = $("<span>")
.addClass("custom-combobox")
.insertAfter(this.element);
this.element.hide();
this._createAutocomplete();
this._createShowAllButton();
this.input.attr("placeholder", this.element.attr('placeholder'));
},
We noticed that the issue was being solved by actually focusing the comboboxes.
Once the combobox is focused, the autocomplete box disappeared and it remained that way when the combobox lost focus.
So, our solution was a bit hack-ish, we added a .focus()
followed by a .blur()
:
_create: function () {
this.wrapper = $("<span>")
.addClass("custom-combobox")
.insertAfter(this.element);
this.element.hide();
this._createAutocomplete();
this._createShowAllButton();
this.input.attr("placeholder", this.element.attr('placeholder'));
this.input.focus().blur();
//^^^^^^^^^^^^^^^^^^^^^^^^^^ Voila!
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With