bootstrap-combobox
bootstrap-combobox copied to clipboard
Blur fails to propagate to jQuery listener
trafficstars
Listening on jQuery onBlur like this:
this.$('select').on('blur', $.proxy(function(evt){
this.$('select').data('combobox').hide();
}, this));
change events work but blur fails until i added event triggers in the blur method like this:
, blur: function (e) {
var that = this;
this.focused = false;
var val = this.$element.val();
if (!this.selected && val !== '' ) {
this.$element.val('');
this.$source.val('').trigger('change');
this.$target.val('').trigger('change');
}
if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);}
//trigger a blur event
this.$source.trigger('blur');
this.$target.trigger('blur');
}
this causes clicking on an option to blur rather then set the value now.... I'll look to other ways to get blur to fire. Basically the problem is that clearing a field doesn't cause change to fire.
Question: why does blur clear out the value if there is one?
, blur: function (e) {
var that = this;
this.focused = false;
var val = this.$element.val();
if (!this.selected && val !== '' ) {
this.$element.val('');
this.$source.val('').trigger('change');
this.$target.val('').trigger('change');
}
if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);}
}