我在使用multiSelect调用此函数时使用了ajax函数。 假设我有一个在ajax加载页面中再次调用的函数
我已经包含了jquery和jquery.multiselect.js包含文件
$('#demo3').multipleSelect({
placeholder: "Select Country",
filter:true
});
$("#button").click(function(){
$.ajax({
url:"http:localhost/mydata",
success:function(data){
$('#demo4').multipleSelect({
placeholder: "Select Country",
filter:true
});
},
});
});
demo3已成功生成多选功能。但是,当我按下按钮时, demo4 中的代码有错误,多选功能尚未在页面中注册?
错误代码说..
Uncaught TypeError: Object [object Object] has no method 'multipleSelect'
我怎么解决这个问题?感谢
答案 0 :(得分:1)
我认为你想要multiSelect
,除非你已经定义了自己的jquery插件函数或者为multipleSelect
使用了另一个插件
$('#demo3').multiSelect({
placeholder: "Select Country",
filter:true
});
此后还有一个额外的});
。不确定你是否需要它。