var input = document.getElementById("input_id");
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
document.getElementById("submit_button").click();
}
});
/*
run:
button click
*/<body>
<form>
<input id="input_id" placeholder="What's on your mind, User?" value="">
<input type="submit" id="submit_button" onclick="alert('button click')" value="Submit">
</form>
</body>