Reputation: 191
<button type="submit" id="button" onclick="btnClick()">ADD</button>
<input type="text" id="prefix" placeholder="type" onkeypress="process(event)">
function process(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13) {
alert("INPUT");
}
}
function btnClick() {
alert("BUTTON");
}
There is an input box and button. The user should be able to enter data by using the button or use the enter key inside the input box.
This all works in Chrome, IE Edge, but errors in IE10. In IE10 when the user hits the enter button, it fires the inputbox event code, and then executes the code for the button as well.
Upvotes: 1
Views: 153