I am trying to find this answer, but all the other questions I have found are React Native.
`handleEnter(e){
if(e.key == 'Enter'){
//REMOVE KEYBOARD
}
}`
Also my input is a text search. So I want the keyboard to hide so users can see the results that e up.
I am trying to find this answer, but all the other questions I have found are React Native.
`handleEnter(e){
if(e.key == 'Enter'){
//REMOVE KEYBOARD
}
}`
Also my input is a text search. So I want the keyboard to hide so users can see the results that e up.
Share Improve this question edited Oct 26, 2018 at 11:58 evgeni fotia 4,8103 gold badges18 silver badges36 bronze badges asked Oct 26, 2018 at 10:40 watthecodewatthecode 1012 silver badges7 bronze badges 1- 1 How are the user supposed to write if you, for instance, hide the keyboard ? You might force a blur as the answer below suggested, but this is extremely dirty from the UX perspective. – Cristian S. Commented Oct 26, 2018 at 10:48
1 Answer
Reset to default 9e.target
is the focused input
or textarea
where the user is writhing. When he click on Enter
the focused input
became unfocused and so the keyboard disappear
handleEnter(e){
if(e.key == 'Enter'){
e.target.blur();
}
}