Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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...
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongodb filter empty array 
Javascript :: add id to html element javascript 
Javascript :: how to add a shadow react native 
Javascript :: ngrok react.js 
Javascript :: flutter circularprogressindicator 
Javascript :: tailwind in react 
Javascript :: ref to another page and achor 
Javascript :: jQuert latest cdn 
Javascript :: unhandledpromiserejectionwarning: mongooseerror: the `uri` parameter to `openuri()` must be a string, got "undefined". 
Javascript :: javascript camera 
Javascript :: get all div elements javascript 
Javascript :: js encode to & 
Javascript :: send file discord js v12 
Javascript :: setinterval break 
Javascript :: nested array of object shows as object in console log output js 
Javascript :: get caret position javascript 
Javascript :: vue print date 
Javascript :: random id number nodejs 
Javascript :: iterate through list js 
Javascript :: add leading zeros javascript 
Javascript :: js wait 
Javascript :: loop array and check if value matches in js 
Javascript :: query selector element with 2 classes 
Javascript :: react native different styles for ios and android 
Javascript :: get number from range line js 
Javascript :: setinterval vs settimeout js 
Javascript :: jquery reset form fields 
Javascript :: javascript alert get text 
Javascript :: geofencing javascript example 
Javascript :: react delete button onclick 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =