I did my research online and did not find appropriate answer.
<ui:define>
<h:form id="formName">
<h:inputText id="p1"/>
<h:inputText id="p2"/>
<h:inputText id="p3"/>
<h:inputText id="p4"/>
</h:form>
</ui:define>
<ui:define name="javascripts">
<script type="text/javascript">
//<![CDATA[
$(document).on('opened','[data-reveal]',function() {
$("#formName input:text").on('keyup keypress', function(e) {
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});
}
My question is for all these input text from id p1 to p4 , I have to disable enter key. Instead of writing KeyPress events for each of these Id's, how to make it neat code?