combined 2 arrays in select box Jquery chosen.js

孤街浪徒 提交于 2019-12-08 04:43:12

问题


I'm using chosen js for my select field.

please check below code.

1> below input box list shows the emails which coming through checkbox selection

for (var x in email_list) {
    var selected_email = email_list[x]['email'];
    output +=   '<input type="text" style="" class="groupCheckBox" name="email[]" value="'+selected_email+'">';
}

2. below is my chosen,js integrated multiple select box. which loads all the emails in db,

var all_emails = json_obj['userEmails'];
output += '<select data-placeholder="" class="chosen-select" multiple style="width:100%;" tabindex="4">';

for (var el in all_emails) {
    var all_emails_lists = all_emails[el][0];
    output +=   '<option value="'+all_emails_lists+'">'+all_emails_lists+'</option>';
}
output += '</select>';

What I want is to combined these two into one , to show the first items as selected items in 2nd select box. and hide those from autocomplete unless the unselect it.

Please advice how to proceed.

来源:https://stackoverflow.com/questions/40027958/combined-2-arrays-in-select-box-jquery-chosen-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!