Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 禁用回车键_Jsf_Primefaces - Fatal编程技术网

Jsf 禁用回车键

Jsf 禁用回车键,jsf,primefaces,Jsf,Primefaces,我想在我的JSF页面中禁用Enter键。我是JavaScript新手。如果可以使用JS, 如何绑定JS和Primefaces组件。您的所有组件都有一个ID,如果没有,请创建它,JS有必要知道与谁一起工作 下面是代码的和平,它是jQuery: $('#your_element_id').keypress(function(e) { if ( event.which == 13 ) { event.preventDefault(); } }); 它将阻止enter执行任何操作

我想在我的JSF页面中禁用Enter键。我是JavaScript新手。如果可以使用JS,
如何绑定JS和Primefaces组件。

您的所有组件都有一个ID,如果没有,请创建它,JS有必要知道与谁一起工作

下面是代码的和平,它是jQuery:

$('#your_element_id').keypress(function(e)
{
   if ( event.which == 13 ) {
     event.preventDefault();
   }
});
它将阻止
enter
执行任何操作