allow new values with chosen.js multiple select

后端 未结 10 1984
囚心锁ツ
囚心锁ツ 2020-12-12 19:30

I\'m using the chosen.js plugin http://harvesthq.github.com/chosen/ with jQuery to allow the user to select multiple options from a select. However, I now want to be able to

10条回答
  •  甜味超标
    2020-12-12 19:31

    Here's a simple way that I did it:

    $(".search-field").find("input").live( "keydown", function (evt) {
        var stroke;
        stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
        if (stroke == 9) { // 9 = tab key
            $('#tags').append('');
            $('#tags').trigger('chosen:updated');
        }
    });
    

提交回复
热议问题