Answers for "how to call function ok enter key press html"

1

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...
}
Posted by: Guest on April-23-2021
1

on enter press button

<input onkeyup="if(event.keyCode===13){submit.click()}"><button id="submit">submit</button>
Posted by: Guest on September-24-2021

Code answers related to "how to call function ok enter key press html"

Code answers related to "Assembly"

Browse Popular Code Answers by Language