> Is there an non javascript way to avoid "enter" keystroke in an input
> to trigger the form submit or am I forced to catch keystroke code 13
> in javascript ?
>
> If force to do in javascript, is there a way to catch keystroke event
> of only one input and not window object ? Is there already a jquery
> plugin for this ?


--------------
document.onkeypress = function(e) {
  if (e.keyCode=='13')
  {
    x = e||window.event;
    t = x.target||x.srcElement;
    if ($(t).parents('#foo').is('#foo'))
    {
     alert('foo form');
      doActionOnlyOnFooForm();
    }
  }
}


<form id="foo" method="get" action="#">
<input />
</form>
<form id="bar" method="get" action="#">
<input />
</form>

---------
... or something like that (I didnt check)

Regards
Michael

Reply via email to