event.returnValue is deprecated. Please use the standard event.preventDefault() instead
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.
This has already been recognised and fixed in jQuery 1.11 (see here and here).
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 500 (Internal Server Error)
Regarding jQuery's event.returnValue thing: it is just a warning, but you will probably want to fix this relatively soon.
The Stack Overflow question you linked to (event.returnValue is deprecated. Please use the standard event.preventDefault() instead) has a great answer up-voted. This warning is not critical, but it is an indicator for you that this will break in the future. You should go through your codebase and change all references to the current version of jQuery to the newest release of 1.x. You may also consider using a non-version-specific filename for your instance of jQuery (e.g. jquery.min.js
instead of jquery-1.10.2.min.js
) so that you can upgrade by just replacing the same file (and not have to change paths/references elsewhere).
It sounds like you have a second problem, though, the error:
GET http:/localhost:AAA/User/FindGWCLoginUsers?strSearch=suresh 500 (Internal Server Error)
...means that you have some problems with whatever back-end service this is in reference to. A 500 could be anything, though, you'd need to check your server logs to find out what's going on.
Why am I getting event.returnValue is deprecated... and how can I rectify it?
see this ticket
http://bugs.jquery.com/ticket/14320
This seems to be happening in the latest version of Chrome. I guess you can not really do much about it but ignore it.
Why is event.returnValue is deprecated? What's the point of this?
In the patch to Chromium that added the deprecated warning, they wrote the following as to why they were deprecating it:
Note that this patch also deprecates Event.returnValue. This used to
be an IE extension but this is no longer supported by IE (nor
Firefox). The standard preventDefault() should be used instead
(supported in IE >= 9).
So now that IE is moving away from using that, they want people to start cleaning up their code to use the standard property, so that it can eventually be removed completely.
In a comment in the code review for the patch, it looks like the developer was going to just remove support altogether in Chrome, but found some places it was still being used and shifted to just throwing a deprecation warning instead.
Both event.preventDefault() and event.returnValue = false don't work in Firefox
You need to provide the Event
parameter:
$('.album a').click(function(e){
e.preventDefault();
//other codes
});
You don't need to deal with returnValue
, as jQuery normalizes the method to work across browsers, by only calling preventDefault
.
Note how the handler in the docs show this eventObject
as the parameter passed to it: http://api.jquery.com/click/
And note how the Event
object has the preventDefault
method: http://api.jquery.com/category/events/event-object/
Related Topics
How to Make a JSONp Request from JavaScript Without Jquery
How to Validate Date with Format "Mm/Dd/Yyyy" in JavaScript
How to Implement Authenticated Routes in React Router 4
Looping Through an Object (Tree) Recursively
How to Get the Mouse Position Without Events (Without Moving the Mouse)
Foreach on Queryselectorall Not Working in Recent Microsoft Browsers
Scope of Sessionstorage and Localstorage
How to Prevent Submitting the HTML Form's Input Field Value If It Empty
Request Header Field Access-Control-Allow-Headers Is Not Allowed by Access-Control-Allow-Headers
What Benefits Does Es2015 (Es6) 'Class' Syntax Provide
Get Hours Difference Between Two Dates in Moment Js
How to Make JavaScript Object Using a Variable String to Define the Class Name
JavaScript "This" Pointer Within Nested Function
Why Is Value Undefined at .Then() Chained to Promise
Hide Scrollbar While Still Being Able to Scroll with Mouse/Keyboard