更改函数名称调用中的单击事件
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'
},
相关文章:
- 将单击事件添加到数据表
- 将单击事件添加到附加的项目中
- 在IE8中不起作用的元素上触发单击事件
- 链接上的IE10 jquery句柄单击事件不起作用
- 如何使用纯 JavaScript 在所有浏览器中区分左/右/中键单击事件
- 如何在master中调用细节网格作为单击事件
- 兰吉 |如何在 span 标签上使用单击事件删除突出显示的文本
- 如何隐藏按钮单击事件上的占位符
- 复选框,然后单击事件处理
- 如何使用for循环添加所有按钮'单击事件
- 手柄'img'单击事件并插入'alt'使用jQuery将属性转换为文本框
- 覆盖单击事件不起作用
- 单击事件打开两个弹出菜单
- 单击事件不起作用
- 从其他元素上的单击事件访问image src属性
- 单击事件中的ajax请求后重定向
- 如何缩放地图框传单中的标记单击事件
- 在没有焦点的情况下捕获画布上的第一次单击事件
- 通过单击事件识别画布上的对象
- 如何将单击事件添加到JQuery中动态添加的元素中