Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Only numbers or string. Input field in React

onKeyPress={(e) => !/[0-9]/.test(e.key) && e.preventDefault()} // numbers only

onKeyPress={(e) => !/[a-zA-z]/.test(e.key) && e.preventDefault()} // alphabets only.
Comment

PREVIOUS NEXT
Code Example
Javascript :: load jquery in the browser code 
Javascript :: how to get current year in nodejs 
Javascript :: javascript get all script tags on page 
Javascript :: mysql innodb_buffer_pool_size 
Javascript :: noconflict jquery 
Javascript :: javascript to integer 
Javascript :: node list files in directory 
Javascript :: javascript filter array of objects by id 
Javascript :: jquery select by name attribute 
Javascript :: Clone an array using the JavaScript slice() method 
Javascript :: how to execute javascript after c# function execute 
Javascript :: a quick introduction to pipe and compose javascript 
Javascript :: error: listen eaddrinuse: address already in use 0.0.0.0:5555 
Javascript :: moment check valid date 
Javascript :: open submenu jquery 
Javascript :: node read csv 
Javascript :: jquery serialize 
Javascript :: get scroll position jquery 
Javascript :: moment calculate duration 
Javascript :: js time difference in minutes 
Javascript :: page redirect after a few seconds 
Javascript :: error: Error: Unable to resolve module `react-native-gesture-handler` from `node_modules@react-navigation ativelibmoduleScrollables.js`: react-native-gesture-handler could not be found within the project. 
Javascript :: javascript one time event listener 
Javascript :: scrollview child layout ( justifycontent ) must be applied through the contentcontainerstyle prop 
Javascript :: get all values of a select javascrip 
Javascript :: find div height in javascript 
Javascript :: FlatList Warning: Each child in a list should have a unique "key" prop. 
Javascript :: discord.js mention regex 
Javascript :: pass only numbers in input react js 
Javascript :: mongoose required 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =