Here is the selector for capture and disable enter key
$(".disableEnterKey").keydown(function(event) {
var charCode = event.charCode || event.keyCode || event.which;
if (charCode === 13) {
event.preventDefault();
return false;
}
});
Disable enter key for inputfield of primefaces-timepicker
<pe:timePicker id="startTime"
value="#{xxx.xxx.var}"
mode="popup" startHours="0" endHours="23"
showPeriod="true" widgetVar="startTimeWidget"
styleClass="form-control keyDownFalse disableEnterKey" >
<p:ajax event="timeSelect" partialSubmit="false"
listener="#{xxx.var}"
update="endTime, duration"
oncomplete="keyDownFalse()"/>
</pe:timePicker>
But the problem here is update attribute under ajax tag. i.e., I'm updating end-time timepicker once start-time timepicker event is triggered. But it should trigger only when hours and minutes choosen from start-time timepicker rather than pressing enter key.
The end-time gets updated once the enter key pressed on start-time.
So please suggest me that what is the exact way to restrict ajax mechanism while pressing enter. Thanks in advance.