Last active
August 26, 2016 18:08
-
-
Save pradeep-dani/d94df923c8c338861f077a2d4a321976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="apexController"> | |
<script> | |
window.onload = function() | |
{ | |
var formElement = document.querySelector("[id$='pageForm']"); | |
if(formElement.addEventListener) | |
formElement.addEventListener("keypress", function(e) | |
{ | |
if(e.keyCode === 13) | |
{ | |
// do stuff | |
SearchJS(); | |
e.preventDefault(); | |
} | |
}, false); | |
else if(formElement.attachEvent) | |
formElement.attachEvent("onkeypress", function(e) | |
{ | |
if(e.keyCode === 13) | |
{ | |
// do stuff | |
SearchJS(); | |
return e.returnValue = false; | |
} | |
}); | |
} | |
</script> | |
<apex:form id="pageForm"> | |
<apex:actionFunction action="{!doSearch}" name="SearchJS" reRender="resultTable, ErrorPanel" status="SearchingStatus" /> | |
<!-- Rest of the form --> | |
</apex:form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment