Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
797 views
in Technique[技术] by (71.8m points)

javascript - event.returnValue已弃用。 请改用标准event.preventDefault()(event.returnValue is deprecated. Please use the standard event.preventDefault() instead)

I have this script:(我有这个脚本:)

<script> $(document).ready(function () { $("#changeResumeStatus").click(function () { $.get("{% url 'main:changeResumeStatus' %}", function (data) { if (data['message'] == 'hidden') { $("#resumeStatus").text("скрыто"); } else { $("#resumeStatus").text("опубликовано"); } }, "json"); }); }); </script> I receive the following error in my Google Chrome console:(我在Google Chrome控制台中收到以下错误:) event.returnValue is deprecated.(event.returnValue已弃用。) Please use the standard event.preventDefault() instead.(请改用标准event.preventDefault()。) I am using jQuery v1.10.2 and #changeResumeStatus is a <span> .(我正在使用jQuery #changeResumeStatus#changeResumeStatus<span> 。) What's wrong with my script?(我的脚本怎么了?)   ask by Alex Parakhnevich translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 .(请参阅Chromium相关来源相应的补丁程序 。) This has already been recognised and fixed in jQuery 1.11 (see here and here ).(这已经在jQuery 1.11中得到了识别和修复(请参阅此处此处 )。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...