Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Capturing enter in javascript

//You can use onKeyPress directly on input field. onChange function changes 
//state value on every input field change and after Enter
//is pressed it will call a function search().

<input
    type="text"
    placeholder="Search..."
    onChange={event => {this.setState({query: event.target.value})}}
    onKeyPress={event => {
                if (event.key === 'Enter') {
                  this.search()
                }
              }}
/>
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongo connect npm 
Javascript :: javascript next friday 
Javascript :: ngfor only x item 
Javascript :: application pool angular 8 
Javascript :: get static props 
Javascript :: delete folder with deno 
Javascript :: react cdn 
Javascript :: hasownproperty javascript 
Javascript :: How to create a GUID / UUID 
Javascript :: react native gif dont work 
Javascript :: javascript to camelcase 
Javascript :: sweet alert angular 
Javascript :: how to convert draftjs content to html 
Javascript :: js substr 
Javascript :: sum index of an array javascript 
Javascript :: js nuxt read/set cookie 
Javascript :: counter with react hooks 
Javascript :: js get each pair of values from an array of objects 
Javascript :: command to start a new react app using vite 
Javascript :: datatable set row id 
Javascript :: onclick on fragment react 
Javascript :: String variable props 
Javascript :: nodejs write to log file 
Javascript :: DC League of Super-Pets 
Javascript :: class component react 
Javascript :: react router dom v6 private route 
Javascript :: mongoose findone multiple conditions 
Javascript :: javascript slice method 
Javascript :: make a bot send a welcome message discordjs 
Javascript :: assign input text value jquery 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =