Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Disable enter key in a form

a form has a field and a button. I'm doing some lookup on the button. When I type some values in the field and click on the button, It works fine. On Opera and Firefox, when I type some values in the field and press ENTER key, it works fine, returns the document.

But when I enter a text and press enter instead of pressing that button, browser displays "Form processed"message

Is there any way to disable enter key in the browser.
0
ninteen83
Asked:
ninteen83
  • 2
1 Solution
 
ninteen83Author Commented:
Internet explorer displays "Form processed"message ..
0
 
madheeswarCommented:
//For fields which enters Enter Key from the field
var NS1 = (window.Event) ? 1 : 0;
function checkKey(e1) {
var code1 = (NS1) ? e1.which : event.keyCode;

if (code1 == "13"){
directory();
return false;
}
}

call this function where ever needed.
0
 
ninteen83Author Commented:
Works fine..

thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now