Select2 open dropdown on focus

前端 未结 16 2197
陌清茗
陌清茗 2020-12-05 00:21

I have a form with multiple text inputs and some select2 elements. Using the keyboard to tab between fields works fine - the Select2 element behaves like a form element and

16条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 00:36

    a bit late... but to share my code using select2 4.0.0

    $("#my_id").select2();
    $("#my_id").next(".select2").find(".select2-selection").focus(function() {
        $("#my_id").select2("open");
    });
    

提交回复
热议问题