0
$().ready(function() {
$("#cont_name2").autocomplete("<?php echo SITEURL;?>calendar/gl_calendar/gl_auto_uname", {
width: 260,
matchContains: true,
//mustMatch: true,
//minChars: 0,
multiple: true
//highlight: false,
//multipleSeparator: ",",
//selectFirst: false
});
$("#cont_name2").result(function(event, data, formatted) {
//$("#meeting_hidden_id").val('');
// $("#meeting_hidden_email").val('');
var hidden_id = $("#meeting_hidden_id");
remove_id_from_hidden(hidden_id);
hidden_id.val((hidden_id.val() ? hidden_id.val() + "," : hidden_id.val()) + data[1]);
var hidden_email = $("#meeting_hidden_email");
hidden_email.val((hidden_email.val() ? hidden_email.val() + "," : hidden_email.val()) + data[2]);
var meeting_email = $("#meeting_to");
meeting_email.val((meeting_email.val() ? meeting_email.val() + "," : meeting_email.val()) + data[2]);
});
});
如何使用此代碼刪除重複的ID?jquery自動完成
你在說什麼重複的ID? – 2011-12-28 12:32:24
當我們從自動完成輸入下拉菜單中選擇任何值時,我們將ID存儲在隱藏字段名稱#meeting_hidden_id中。如果我們再次從下拉列表中選擇相同的名稱,那麼id將在同一隱藏字段中再次重複 – 2011-12-28 12:35:38