0

I want to disable Enter key in my JSF page. I am new to JavaScript. If it is possible with JS, how can I bind JS and Primefaces components.

jacop41
  • 152
  • 7
  • 25

1 Answers1

1

All your components have a ID, if it doesn't, create it, it is necessary for JS to know with who he is working with.

Here is a peace of code, it is jQuery:

$('#your_element_id').keypress(function(e)
{
   if ( event.which == 13 ) {
     event.preventDefault();
   }
});

It will block the enter to execute anything.