0
선택한 jquery 플러그인을 사용하고 있으며 변경 이벤트가 호출 되 자마자 열린 이벤트를 트리거하여 모든 옵션이있는 검색 막대가 표시되도록하려고합니다.변경 이벤트 후 선택 트리거 이벤트 열기
HTML 코드 나 콘솔에 때 $('#myselect').trigger('chosen:open');
가 검색 창 및 옵션을 열어
$(document).ready(function() {
$('#myselect').chosen().change(function(){
// alert('change event called');
$('#myselect').trigger('chosen:activate');
$('#myselect').trigger('chosen:open');
add_food({{profile_id}});
});
});
있지만
<select id="myselect" data-placeholder="Add foods you can buy here." style="height:30px;width: 100%" class="chosen-select" >
<option value=""></option>
{% for each in food_list %}
<optgroup label={{each.node}}>
{% if each.children %}
{% for eachchild in each.children %}
<option>{{eachchild}}</option>
{% endfor %}
{% else %}
<option>{{each.node}}</option>
{% endif %}
</optgroup>
{% endfor %}
</select>