我有一个表单,我使用令牌输入插件从预定义列表中选择多个项目。但是Ondelete功能不起作用。
<script type="text/javascript">
$(document).ready(function() {
var1_ids = '<?php echo $records[0]['team_member']?>';
$("#team_member").tokenInput("<?php echo base_url(); ?>staff_activity/get_members", {
theme: "facebook",
prePopulate: [<?php echo $show1; ?>],
resultsFormatter: function(item){ return "<li>" + " " + "<div style='display: inline-block; padding-left: 5px;'><div class='full_name'>" + item.first_name + "</div></div></li>" },
tokenFormatter: function(item) { return "<li><p>" + item.first_name + "</p></li>" },
onAdd: function (item) {
var1_ids = var1_ids + item.staff_id + ',';
$('#team_member_ids').val(var1_ids);
},
onDelete: function (item) {
var1_ids = var1_ids.replace(item.staff_id+',','');
$('#team_member_ids').val(var1_ids);
}
});
});
</script>
其中var_dump($ records [0] [&#39; team_member&#39;]?&gt;);是字符串(11)&#34;,900,4,979,&#34;