how to get function call on pressing enter button code example
Example: html javascript call function after pressing enter
var yourElement = document.getElementById("yourElement");
yourElement.addEventListener("keydown", function (e) {
if (e.code === "Enter") { //checks whether the pressed key is "Enter"
validate(e);
}
});
function validate(e) {
var text = e.target.value;
//validation of the input...
}