Trying to a seemingly simple thing before going live with the AJAX code I have been working on. I don't want pressing the enter key to submit the form when a field is in a particular field. This turned out to be harder than I thought. But here is the code that does it:
Include the following element into the head part of your document:
/script type="text/javascript"/
function noenter() {
return !(window.event && window.event.keyCode == 13); }
/script/
Add the following attribute into each input type="text" tag(s) in your form:
onkeypress="return noenter()"
The function has to go in the header on the page. It didn't work for me putting it in an included .js file.
Friday, October 27, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment