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.
Asked
Active
Viewed 2,727 times
1 Answers
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.