How to enable enter key for searching purpose.
We have a drop-down box for selecting the search criteria and a textbox for entering the search value. we have a "search" button besides the textbox for searching the related values.
Now we need to enable the enter key (Keyboard) functionality for search purpose.
JSP Code:
<html:text name="ABCForm" size="30" property="searchCriteriaText" onkeypress="normalSearchEnter(event);" />
JS Code:
function normalSearchEnter(oEvent) {
if ((oEvent.keyCode && oEvent.keyCode==13) (oEvent.which && oEvent.which==13)) {
normalSearch(); // Call the usual function that will be invoked when search button is clicked
}
}
0 Comments:
Post a Comment
<< Home