vakas
vakas

Reputation: 1817

event.preventDefault not working in mozilla

its wrking in ie but not in mozilla wats the alternate

  function preventBackspace(e) {

          var evt = e || window.event;
         // alert(evt);
          if (evt) {
              var keyCode = evt.charCode || evt.keyCode;
             // alert(keyCode);
              if (keyCode === 8) {
                if (evt.preventDefault) {
            evt.preventDefault();
                 } else {
                      evt.returnValue = false;
                 }
              }
          }
      }

infact evt.returnvalue=false is not wrking in mozilla

Upvotes: 1

Views: 1517

Answers (1)

Matthew Flaschen
Matthew Flaschen

Reputation: 284786

I did a simple test (jsfiddle), and your function does work in Firefox. As expected, it never executes the non-standard returnValue part.

Upvotes: 2

Related Questions