簡體   English   中英

清空時觸發Typeahead.js事件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM