Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

i wanted to detect when a user enters an alphabet key in input text javascript

document.addEventListener('keyup', event => {
  if (String.fromCharCode(event.keyCode).match(/(w|s)/g)) {
    //pressed key is a char
  } else {
    //pressed key is a non-char
    //e.g. 'esc', 'backspace', 'up arrow'
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: store string in array javascript 
Javascript :: stop React Ant Design Upload component from posting files automatically 
Javascript :: how to pass string in javascript function 
Javascript :: get current tab url in chrome extension in popup 
Javascript :: how to define array in react js 
Javascript :: NGX loading Interceptor 
Javascript :: Search products by startsWith in javascript 
Javascript :: id generator using javascript 
Javascript :: Fabricjs configurations 
Javascript :: access object data 
Javascript :: nodejs process object 
Javascript :: add validation in strapi 
Javascript :: jquery selected checkboxes pass as paramater to C# 
Javascript :: nvm install a particular version 
Javascript :: return array odd or even outlier 
Javascript :: javascript centuries 
Javascript :: GetNameOfZone 
Javascript :: animejs code sample for keyframe property 
Javascript :: convert datetime to milliseconds in javascript 
Javascript :: anonymous functions 
Javascript :: javascript query corrector 
Javascript :: apostrophe issue in javascript 
Javascript :: how to merge data react native 
Javascript :: Return the N-th value of the Fibonacci sequence 
Javascript :: angular interpolation check if value is null 
Javascript :: javascript grow function 
Javascript :: pass data from popup js 
Javascript :: get size of json array online 
Javascript :: variable hoisting 
Javascript :: dynamically create html table in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =