从对话框调用函数时is not a function
出错
从对话框中单击按钮:
Add: {
class: 'calendareventleft',
text: 'Add',
click: function() {
var title = $("#title").val();
var description = $("#description").val();
var otherinfor = $("#otherinfo").val();
$(this).ajaxcall(title, description, otherinfor);
}
}
显示对话框的按钮
$('#button').click(function() {
$("#dialog").dialog({
title: "qwe"
});
$("#dialog").html("<div>" + "<form>" + "Title:<br>" + "<input type='text' id='title' class='calendarinput'>" + "<br>" + "Description:<br>" + "<textarea id='description' class='calendarinput calendartxtarea'></textarea>" + "<br>" + "Additional Information:<br>" + "<textarea id='otherinfo' class='calendarinput calendartxtarea'></textarea>" + "</form>" + "</div>");
$("#dialog")
.dialog("open");
})
我需要运行的功能
function ajaxcall(title, description, otherinformation) {
consoole.log(title);
consoole.log(description);
consoole.log(otherinformation);
}
您正在调用$(this).ajaxcall(....)
它期望ajaxcall
是插件方法的位置,但这不是为什么该错误。
像这样称呼它
ajaxcall(title, description, otherinfor);
演示:小提琴
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句