$(...)。on不是一个函数 - jQuery错误 [英] $(...).on is not a function - jQuery Error
本文介绍了$(...)。on不是一个函数 - jQuery错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用对话框,当用户在页面上的任何位置点击该对话框时,我将关闭。
I am using dialog box, which I am closing when a user click anywhere on page expect that dialog box.
这是我的代码:
$('body').on('click','.ui-widget-overlay',function()
{
$('#myRateSettingsPopup').dialog('close');
});
不知何故,它返回错误:
Somehow its returning an error:
$(...)。on不是一个功能
我的代码有什么问题?
我正在使用jquery-1.6.1.min.js,但是我无法将其更新到最新版本。我有约束。
I am using jquery-1.6.1.min.js , but I cannot update it to the latest version. I am bound.
有没有其他方法可以做到这一点?
Is there any other way to do this ?
推荐答案
方法 on 是在jQuery版本1.7中引入的。
Method on was introduced in jQuery version 1.7.
我想你必须将jQuery库升级到最新版本。
I think you have to upgrade your jQuery library to the newest version.
$( ".ui-widget-overlay" ).bind( "click", function(e) {
$('#myRateSettingsPopup').dialog('close');
e.stopPropagation();
});
这篇关于$(...)。on不是一个函数 - jQuery错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文