[英]change click event in function name call
我正在尝试自定义默认的删除确认弹出窗口。我正在使用此插件来自定义弹出窗口。在插件中,它们使用onclick按钮进行了演示。但是在我的应用程序中,我使用的是javascript函数内的“确认”对话框,
来自插件的实际示例
$('#button_2').confirmOn({
questionText: 'This action cannot be undone, are you sure?',
textYes: 'Yes, I\'m sure',
textNo: 'No, I\'m not sure'
},'click', function(e, confirmed) {
if(confirmed) $(this).remove();
});
我在下面尝试自定义确认对话框,
function deleteFollow(url, obj){
confirmOn({
questionText: 'This action cannot be undone, are you sure?',
textYes: 'Yes, I\'m sure',
textNo: 'No, I\'m not sure'
}, 'click', function(e, confirmed){
if(confirmed)
''''''''''''
ajax post comes here
''''''''''''''''
上面在控制台中给出的错误为“ Uncaught ReferenceError: confirmOn is not defined
”。如何为我的实际功能实现或更改原始内容。
您的第二个confirmOn()
没有jQuery前缀:
function deleteFollow(url, obj){
confirmOn({
//your code
应该:
function deleteFollow(url, obj){
$.confirmOn({
//your code
要么:
function deleteFollow(url, obj){
$("#foo").confirmOn({
//your code
试试你的代码
function deleteFollow(url, obj){
confirmOn({
questionText: 'This action cannot be undone, are you sure?',
textYes: 'Yes, I\'m sure',
textNo: 'No, I\'m not sure'
},
改成
function deleteFollow(url, obj){
$.confirmOn({
questionText: 'This action cannot be undone, are you sure?',
textYes: 'Yes, I\'m sure',
textNo: 'No, I\'m not sure'
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.