Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

detect keypress javascript

document.addEventListener("keypress", function onEvent(event) {
    if (event.key === "ArrowLeft") {
        // Move Left
    }
    else if (event.key === "Enter") {
        // Open Menu...
    }
});
Comment

if keypress javascript

// Create your variable and asssign it to your ID or Class in the document using document.querySelector.
let name = document.querySelector('#exampleInputEmail1');

// Now use your variable and add an event listener to it plus your keypress, event and styling
name.addEventListener("keypress", (event) => {
   name.style.border = "3px solid #28a745";
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: express js limit access based on rate 
Javascript :: javascript to integer 
Javascript :: express get cookie 
Javascript :: jquery varable exists 
Javascript :: move list items up and down using javascript 
Javascript :: p5.js boilerplate 
Javascript :: jquery insert text into input 
Javascript :: Clone an array using the JavaScript slice() method 
Javascript :: how to check element is in viewport 
Javascript :: default ordering false in datatable 
Javascript :: jquery prop checked 
Javascript :: js check file exist 
Javascript :: javascript truncate with ellipsis 
Javascript :: image is not displaying in react js 
Javascript :: javascript merge two lists without duplicates 
Javascript :: nx serve 2 applications 
Javascript :: discord.js empty field 
Javascript :: loop json 
Javascript :: input type number react native 
Javascript :: popper.js install npm 
Javascript :: take data from url parameter and change using htaccess new url 
Javascript :: npm could not determine node.js install directory 
Javascript :: javascript not null 
Javascript :: vuejs form prevent default event 
Javascript :: loop over javascript using foreach 
Javascript :: html-webpack-plugin npm 
Javascript :: javascript full screen 
Javascript :: update angular cli 10 
Javascript :: nodejs merge 2 objects 
Javascript :: How to update node.js in replit 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =