event.returnValue 已弃用.请改用标准 event.preventDefault() [英] event.returnValue is deprecated. Please use the standard event.preventDefault() instead

查看:139
本文介绍了event.returnValue 已弃用.请改用标准 event.preventDefault()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个脚本:

<script>
$(document).ready(function () {
    $("#changeResumeStatus").click(function () {
        $.get("{% url 'main:changeResumeStatus' %}", function (data) {
            if (data['message'] == 'hidden') {
                $("#resumeStatus").text("скрыто");
            } else {
                $("#resumeStatus").text("опубликовано");
            }
        }, "json");
    });
});
</script>

我在 Google Chrome 控制台中收到以下错误:

I receive the following error in my Google Chrome console:

event.returnValue 已弃用.请改用标准 event.preventDefault().

event.returnValue is deprecated. Please use the standard event.preventDefault() instead.

我使用的是 jQuery v1.10.2 并且 #changeResumeStatus 是一个 .

I am using jQuery v1.10.2 and #changeResumeStatus is a <span>.

我的脚本有什么问题?

推荐答案

这只是一个警告:您的代码仍然有效,但由于该方法已被弃用,将来可能无法工作.请参阅 Chromium 的相关来源对应补丁.

This is only a warning: your code still works, but probably won't work in the future as the method is deprecated. See the relevant source of Chromium and corresponding patch.

这已在 jQuery 1.11 中得到识别和修复(参见 此处此处).

This has already been recognised and fixed in jQuery 1.11 (see here and here).

这篇关于event.returnValue 已弃用.请改用标准 event.preventDefault()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆