[英]Typeahead.js event fired when emptyed
我有Typahead.js plagind,想在输入字段为空时将data-id
属性设置为''
。 现在,当选择了特定建议时,我将使用它来设置data-id
,但是当其为空时将无法捕获事件。
typeaheadFields.bind('typeahead:select', function (ev, suggestion) {
$(this).parent().find('.attribute-slider-category-id').attr('data-id', suggestion.id);
});
固定与此:
typeaheadFields.keyup(function () {
if ($(this).val() == '') {
$(this).parent().find('.attribute-slider-category-id').attr('data-id', '');
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.