<input id=”xxInput” value=”Some text..”>
<button id=”xxBtn” onclick=”javascript:alert(‘Hello Sam!’)”>Button</button>
<button id=”xxBtn” onclick=”javascript:alert(‘Hello Sam!’)”>Button</button>
<script>
var input = document.getElementById(“xxInput”);
input.addEventListener(“keyup”, function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById(“xxBtn”).click();
}
});
</script>
More Details: Click