2

this is sindhuri,I receive the following warning in my Google Chrome console: event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery1.9.1 version i am using.

<script>
window.jQuery(document).ready(function () {
    window.jQuery('#hideshow').click(function () {
        window.jQuery('#message').toggle(function () {
            window.jQuery('#hideshow').text('Show');
            window.jQuery('#message').hide();
            alert("message hide succeesfully");
        }),
        function () {
            window.jQuery('#hideshow').text('Hide');
            window.jQuery('#message').show();

            alert("message show succeesfully");
        }
    });
});
</script> <a href="#" id="hideshow">Hide</a>
BeforeUnloadEvent has a returnValue attribute. Setting returnValue to a non-empty string in an event handler causes the user agent should ask the user to confirm that they wish to unload the document. This is equivalent to returning a non-empty string in the EventHandler
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
sindhuri
  • 29
  • 1
  • 1
  • 2

3 Answers3

4

It's a bug

This is only a warning message your code will still work.

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
4

this is not a bug...

just use the latest version thats going to come out soon (1.11) and you'll be fine

this has a jquery.com open ticket :

The bug is fixed in what will become 1.11/2.1. The duplicate bug ticket #14282 explains this. It also explains that older versions of jQuery will give this warning eternally.

elad silver
  • 9,222
  • 4
  • 43
  • 67
-1

Code will work but in some condition another event is fire because of that warning. And your output will effect somewhere in view page(Probably with jquery ajax call).

Deepesh
  • 590
  • 6
  • 8