keypress javascript

Solutions on MaxInterview for keypress javascript by the best coders in the world

showing results for - "keypress javascript"
Marylou
17 Feb 2017
1document.addEventListener("keypress", function(event) {
2	// do stuff
3});
Josefina
16 Sep 2016
1<input type="text" onkeypress="myFunction()">
Ryland
28 Feb 2020
1The keypress event has been deprecated, 
2you should look to use beforeinput : https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforeinput_event
3or keydown : https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event
4instead.
5
6(And don't forget to like answers that help you !)
Sara
05 Nov 2018
1let b = document.getElementById("body"); //making var for body
2b.addEventListener("keydown", (evt) => {//when this happens
3	console.log(evt.keyCode); //log keycode
4});
5
Melina
05 Mar 2020
1// Create your variable and asssign it to your ID or Class in the document using document.querySelector.
2let name = document.querySelector('#exampleInputEmail1');
3
4// Now use your variable and add an event listener to it plus your keypress, event and styling
5name.addEventListener("keypress", (event) => {
6   name.style.border = "3px solid #28a745";
7});
queries leading to this page
what is keypresshandling keypresses javascripthow to detect keys being pressed javascripthow to have key press 40js keypress key codespecific keypress event listener javascriptjavascript keypress numberjavascript key inputsdetect key press inputjs on keyjavascript keypress without listenerhow to use keypress eventcheck what key is pressed javascriptonkeypress display textkeypress event value javascriptjavascript pressed keykeypress listener javascript 3d 22 22input keypressevent javascript onkeypress 24eventhtml get keyboard inputonkeypress search boxjavascript event listener keypresskeypress to listener online jsjavascript detect key presshow to detect when a certain key is pressed htmljavascript element onkeypresson specific key press javascriptjquery on keypresshow get pressed key jsjava script keypress eventif key press javascriptjs detect enter key pressfunction keypress javascript full websitejs do something when a key is pressedaddeventlistener on keypressjs function on key presskeypress listener javascripton key press javascriptjs event for when a key is pressedjs if key pressedjavascript do something when key is pressedprogram a key to do something javascriptwhat is javascript keypresskeypress down jspress key in jskeypress in input javascriptkeypress in jshow to check for the key pressed in javascriptkey pressed in input javascripton specific keypress javascriptinput type text onkeypress javascriptjavascript event listener keypress specific keyaddeventlistener 28 22keypress 22key press javascripton key eventjs key pressedhow to identify keypress in javascriptjavascript keypress evnetif a certain key is pressed jscheck for keypress javascripthow to get onkeypress event jswhich key is press javascriptget pressed key javascriptjavascript onkeypress do somethingcheck window key is pressed jskey pressed javascriptkeypressed eventevent listeners key press javascript javascript click a button when a keyboard key is pressedspecific keypress in jshow to get key value from keypress javascripttext input on ke pressget key label keypress javascriptjavascript detect keystrokeif a key is pressed then jsonkeypress get keycss keypresskeypress function javascripton key pressjavascript keypressadding a event listner for a keystrokejs get user key presson press jshow to detect keypress in javascriptevent onkeypresshtml event listener specific keyonkeypress on input field in jshow to simulate a keypress in javascriptjs key pressed eventkeypress event textbox using javascriptkeypress value javascriptvanilla js keypresskey pressed event in javascripthtml input key eventjavascript function keypressany key press event in javascriptkeyboard press event javascriptjs funciton on keypresssjs eventlistner no keypressedjs detect pressed keyjavascript keypress event get characterkeypress js call functionaddeventlistener input keypressonkeypress onclick javascriptjavascript how to add keypress eventevent in a specific key pressif pressed 5c key jswindow onkeylisten keydown of number in javascriptjavascript keypreson key press jscheck character onkeypress in html input fieldany keypress event in jquerykeypress in html javascriptaddeventlistener for keypressjavascript key pressing eventjavascript get key pressedhow to detect which key is pressed in javascriptkey press event javascriptkeypresss eventonkeypress jscheck if any key keypress javascriptonkeypress javscritpy keypress javascripthow to get presed keywhile key pressed jshow to detect key presses javascriptwhich key was pressed javascriptonkeypress specific keycheck key pressed javascriptjs get keyboardjs input keypressjavascript which key ist pressedjs get key pressedjavascript read key pressedhow tocheck for keypress javascriptinput onkeypress jseventlistener keypressedaddeventlistener key pressed javascriptkeypress coller javascriptjs keypress checkinput onkeypress javascriptjs keyboard pressjavascript make a quiz that takes keyboard inputdetect key press jshtml keyboard inputevent listener javascript keypresskeypreess event jsjs keypress writeevent kaypressjavascript key pressed eventget text input when key presshow to get keyboard input in javascripthow to detect a keypress in javascriptlisten for keypress jsinput key press javascriptwhich key pressed javascriptbutton and onkeypressjs when key is pressedkeypress function in javascriptlisten for keypressjavascript onkeypress function for inputhow to nkow which key was pressed javascript keypress eventsjs get key pressed on inputreturn onkeypressonkeypress add display textjavascript textbox listener keypressonkeypress 5eif any key is pressed javascriptjavascript input on keypresshow to do something when a key is pressed in jsjavascript initiate keypresshow to detect a keypress javascripthow to use a function when a key is pressed website javascripthtml on key presseddom keypressjavascript get keyboard onkeypress in javascriptjavascript event keypressget the key pressed javascriptget input from keyboard javascriptif any key was pressed jsjs mouse presseddocument onkeypresscan we get which key is pressed in jsget text from keyboard in jshtml onkeypressjavascript listen keypressonkeypres javascript w3schoolsjavascript when key is pressedhow to keypress in javascripthow to determine keyboard click in javascripta onlick htmlon keypress in node jsif keypress javascriptjs addeventlistener keypressdetect when key pressed javascripthow to add keypress event in javascriptjs on enter pressedphp get key eventhtml event keypresson keypress event on input fonction keypress javascriptonkeypress vanilla jsonkeypress html attributejava onkeypresskeypress event listener jses6 check key pressjs keypressdjavascript detect keykey press event listenerjavascript listen on page keypressdocument on keypress jsdetect keypress jsdocument keypress eventjs event keyjs press keyjavascript event listener for keypressjavascript addeventlistener keypressdetect key input javascriptcheck what key is being pressed jscheck key press in javascriptjavascript do keypresshandlekeypresseventonkeypress get keycodeget key character jsjs keypress codeshow to get the key pressed in javascripton key press in javascripton certain keypress jshow tochec if a keyboard key is pressed in javascriptjavascript onkeypress function examplewindow onkeypress how to do input get key javascriptjs on keyboard keypresskeypress event jshow to sense when a key is pressed in javascriptjs click and keypressjs code that when you press a keykey press event how to make javascript sense whether a key is pressedjavascript how to use keypress event listeneron input key presscatch data keyboard javascriptfunction if key is pressed javascriptlisten for keyboard input 40 character javascriptpress key using javascriptusing id for keypress in javascriptjs value of keypressonkeypress javascript on phpkey press jskeypressesd event listnerkey pressed jaavscript c3 b9javascript on keypress check for divjavascript onkeypress ehow to detect key press in javascriptkeypress event listener javascriptkeypress event in jsjavascript detect when key pressedpress key on jskeypress event javascriptonkay pless event syntaxe jsusing onkeypressjs lisening for keypressjavascript event listerner which letter keypressjavascript get the pressed keydocument on keypresskeyboard event get characterhow to check if a key is pressed in javascriptjavascript press keyonkeypress en javascriptjs detect what key was pressedjavascript listen for keypresshow to handle a keyboard press javascripthow to get keypress value in javascriptjavascript input from keyboardjs eventlistner nokeypressedjs set event on key pressedkeypress ebventjs listen for keypressjavascript get keypresseddocument keypress listenerhtml onkey pressonkeypress in formjs how to know which key pressedadd event listener onkeypreshow to do onkeypress event in javascripthtml onkeypress in documentkeypress event on windowkey 5bpress javascriptjavascript check which key pressedhtml onkeypress eventjs onkeypress eventwhat does keypress mean in javascriptonkeypress htmljs input onkeypresslisten for keybind javascriptkeypress example javascriptjs key hold pressedonkeypress input javascripthow to link gooogle on keypreess event in htmljavascript keypress event on inputadd event listener for keystrokeswindow onkeypress javascriptget last key pressed javascripthow to find out keypress in javascriptjs window onkeyjs key event listenerskeypress event listener in javascriptgetting a keypress jsget key pressed from event jsjavascript keypress eventsjavascript displaying key pressget key pressed javascriptuser pressed key in javascriptonkeypress eventon keypress eventjavascript event listerner check keypressonkeypress on inputcheck last key pressed jskeypress keycode javascriptkey press in jsevent keypress jstextbox on keypress event javascriptadd event listener to keypressjs watch for key preseventlistener onkeypresshow to specific which key press json press javascriptjs get pressed letterwindow keypress event in javascriptjavascript keypress characterhow to check the pressed key in jsjavascirpt keypressonkeypress jqueryonkey event javascriptget what key is pressed javascriptwhat is keypress in javascriptwhen press key jsonkeypress in form tagonkey jsnode js keypresscheck character onkeypress jsjs event list keypresshow to find what key user press htmljavascript detect keypresshow to get pressed key in javascripton key press function jsjs get event keypresshtml keyup eventhtml js onkeypresscheck is any key pressed in javascriptjs key event text inputkeypressed in javascriptuser typing on keypresson key preess in inputjs check which key is pressedfunction listen to keypress elements javascriptjs input on keypressjavascript get key presshow to get the key press event in javascriptkeypress javascript codedo something on keyboard click javascriptjavascript listen on key pressjavascript key inputdocument on type keyjavascript specific key pressonkeypress browser javascriptkeyboard inpuit javascriptkeypress event input javascriptjavascript handlekeypressno action key press eventif key pressed jskeypress event get characteraccessing the key pressed javascriptjavascript key value pressedhow to know which key is pressed in javascriptjavascript keystrokekeypress s jshow to handle keypress event in javascriptkeypress event then javascriptkeyboard key press event javascript get pressed key in javascriptkeyboard listener presshow to check if key is pressed javascripthow we make key press event in javascriptjavascript listen to keypressonenter onkeypressjavascript which key pressedjavascript input keypresskeypress javascriptjs keypressjavascript get keyboard inputhow to approach an on key press in javascriptkey pressed jsjavascript event on keypresshow to check if a key is pressed in keyboard with javascripthow to check if specific key board key is pressed javascriptpress keyboard key using javascriptjs on key pressswhile key is pressed javascriptjavascript keypress on pageon key press event in jsjs press a keyonkey press in javascript htmladdeventlistener keypresskeypress event in htmlhow to identify a key press javascriptcheck when user as pressed a key javascriptinput on keypress jscheck if shift key is pressed javascriptspecific key press event javascriptjavascript code for keypress eventon key event jsonkeypress javascript w3schoolshow to check if any key is pressed on keyboard jsdetect when a key is pressed jshow to determine if a key is being pressed javascriptevent on adding a particular key in javascriptonkeypress in html event handlerread clicked key jshow do i listen to a keypress in javascriptonkeypress event jsjs keypress ajavascript key pressedjavascript on keybaord pressjs detect key pressedevent onkeypress javascriptevent listener keypress ponkeypress event in javascriptonkeypress in textbox in htmlhow to find the keyboard was pressed on keyboard javascriptinput keypress event javascriptget input html keypressjs event for key pressjs press key pressget key input jsjs keypress eventjavascript get keyboard eventjavascript how to get a keyboard inputjs html onkeyjavascript document keypressevent keypresshow to know which key was pressed javascript keypress eventjavascript on jey pressadd event keypress javascriptonkeypress in input boxkeypress event htmlonkeypress instead of buttonjs perform key pressjavascript know the key pressedperform key press in jscheck for key presses html onkeypressonkey enter javascriptbutton onkeypresshow to detectect key presskeypress document javascriptjs event keypressget key label keypressed javascriptlisten keypress javascriptassign event to a keypress javascriptonkeypress codeinline how to write keypress event in c 23javascript key preesedcan you make javascript press a keyboard keydetect keypresses javascriptnew keypress event jskeypress eventlistenerjavascript key pressed event 2bjavascript keystroke eventkey event listenerjavascript on key pressedhow to add a window keypress event in javascriptjavscript listen to key pressjavascipt on keypress keyjs onpress keyonkeypress of keyboard event 2bjslisten for keypress javascriptjavascript html press keyhow to get the key that was pressed 3bjavascirptjavascript get pressed keyjavascript key press eventjs keypress value detect key press javascriptjavascript keyboard inputhjavascript key presskeypress in field javascriptif key press jsjs on keypressif key is pressed jssee what key pressed javascriptjs keypress ocheck for keypresses javascriptjavascript how to know which is key pressedhow to get key presses in javascriptjavascript keypress exacthow to view what key was pressed javascripthow to get which key is pressed in javascriptpressed state of key javascripthow to get keypresses jsjavascript detect what key is pressedjs html onkeypressaddeventlistener keypress javascriptkeypress using javascriptdetect keypress javascriptonkeypress w3schoolshow to get the variant if i enter from keyboard using javascriptpress a key using javascriptjs how to detect keypresshow to press a key in jsaddeventlistener keypress ignores first keyhtml detect keyboard inputjavascript keyboard pressonkeypress javascriptevent key pressed jsjavascript keypress codesonkeypressed javascriptjs keypress characterif 28e keycode 3d 3d 3d 13 29 7bkeypress event javascrioptjavascript detect key inputprint the pressed key javascriptjs if key is pressedget w key 5bpressed javascriptjs onkeypressjs keyptessjavascript detect any keypressjs listener keypresskeypressed javascriptjavascrip on keypresskeypress js event listenerget the presses key in javascriptjavascript keypress handlerif statement with onkeypress html jshow to know which key is press using key event in jsif enter key was pressed jsjavascript keypress event get keyjs press key eventhow to press a key through code javascriptget keystroke javscripthtml detect key presson keypress javascriptwindow keypresswindow keypress eventhow to identify which key is pressed in jshow to click a button when key is pressed jseventlistener on keypressjavascript onkeypresshow to get a key pressonkeypress onkeydownkeypress browser javascripthtml onkeypress uphtml5 on keypresshtml input keyaddeventlistener javascript keypressadding eventlistener key press event in javascripton key pressed javascriptjavascript add on keypresshow to get get input keys in jslisten for key press jskey press in javascriptjs on key is presseddocument addeventlistener 28 22keypress 22presskey jskeypress en jsjs track pressed keyonkeypressjavascript read keyboard inputcheck key press javascriptjavascript code to handle the keypress eventfind which key is pressed in javascriptkeypress js numberdetermine which key was pressed javascriptget the pressed key in javascriptkey event listener javascriptvanilla js keypress listen elment keypresshandlekeypressevent actuvekeypresses in jswhat use instead of keypress jsattach keypress event javascripthow to know the key pressed jsjavascript on keypressget key press jshow to get on key listen on javascriptonkeypress javascript eventkey is pressed jsdocument keypress javascriptkeypress eventsjavascript on key pressjavascript do function on keypressget key pressed jsdetect key pressed javascriptcapture key press javascriptget key press onkepresshtml on key pressjquery keycokeypress event in javascriptjavascript if key is pressedpress a key jswhat is the best way to detect specific keystrokes in javascriptwhich key is pressed javascriptjavascript document onkeypresskeyboard key press with jshow to detect key type in javascriptjs event listener keypresskey press events jscheck if a key is pressed javascriptinput key press eventkeypress event javascript how to know which key is pressedkeyenter eventkeypress event objecthow to put on certain key eventon key press event in japress key in javascriptkeypress js eventkeypress up jswhere to attach keypress eventsjavascript detect input keyexecute keyboard key press in jshow to detect key input jsjs on keypreskeypress jssevent listener for keypress input javascriptkeyboard press javascriptif key pressed javascriptjavascript handle keypress eventevent listener for keypress jskeyevent listener jswhen do we use keypress listener in javascripthow to sense when a specific key is pressed in javascriptdetect spcific key press javascripthtml register key pressedwindow addeventlistener keypressdetect key press javascript mozillalisten for any key pressed in jscheck which key is pressed javascriptread keyboard input jsinput html keypressjs eventlistener keypresskeypress default actionevent listener keypress jskeypress event for number in javascriptjs handle key pressjava scirpt element on onkeypresscan webpage detect keystrokeswhich key has been pressed jshow to have javascript know when a key is pressedon keypress in javascripthtml event listener keypress focuson key press htmklwhen is key pressed jshow to detect key presses in htmlhow to have a specific key press as an input in javascriptjs get any key pressedpress number on keyboard and have it show up in htmlget keyboard input javascriptevent listener for key press jscss keystroke syntaxwatch for key press javascriptjs event for when a certain key is pressedaddeventlistener keypress 0on press key event javascriptjava script input keyboaraonkey press eventhtml js on kex pressjs event on keypressdocument onkeypressedjavascript keypress event listenerjavascript get the key of inputonkeypress javascript exampleon key pressed jsonkeypress get keythow to use keypress in javascriptdocument on key clickjavascript window keypresskeypress iin jsjs on keyprehow to use keypress event in javascriptjavascript on specific key press ajavascript keypress functionkeypress is which eventinput text keypress eventtype on pressing any key html jspress key javascriptjavascript show which key is pressedjavascript keydown get keykeypress event whichevent listener key press javascriptdisplay which key is pressed javascriptjs write with keypressadd event listner for keypresshow to get pressed key check which key is pressed jshtml on keypresshtml on any key pressget all keyboard javascriptjavascript keypress codeadd key press enet js 24 in javascript on keyboardjavascript 2b get key eventskeypressedevent javascriptpress key event javascripthow to capture keypress event in javascripthow to get key pressedhow to detect any key pressdocument keypresshow to get a key pressed in javascriptdetect when a key is pressed javascriptlisten to keypress eventkeypress js wesboxdetect when a key is being pressed in javascriptrun function on keypress javascripthow to do a key press in javascripton input keypress jshow to detect key down jsif key is pressed then jsonkeypress javascript documenthow to press a key using javascripthow to see what key is being pressed javascripton keypress jsicon show while keypress in html cssif keypressed javasciptkeypress jajavascript press key eventjavascript 3ainput and keypress eventonkeyboardpress javascriptjavascript on key pressed eventonkeypress do functiondocument addeventlistener keypressjavascript on key pressed get inputinput key pres jsjavascript how to detect keypresskey pressed javaxcriptkeypress keyeventkeypress event listenerif key is pressed javascriptjs detect what key is pressed onkeypress in phpcheck key press in jsjavascript keypressedevent listeners keypress javascripthow to make key press events which key press input jsspecific keypress event in htmlwhen key pressed jsjavascript keypress listenerjavascript detect every keypressangular get keycode on div click html keystrokeonkey and onkeypressjs check key pressedkeypressed jskey pressing javascripthow to use keypress function in jsfind keypress from eventjs key pressesjavascript listen to event of keypress a keyboard input in html 3fonkeypress in inputjavascript key event listenerjs onkeypress get keykeypress eventidentify key pressed and change cssphp on key pressdocument onkey presshtml input on keypressjavascript onkeypress keycodehow do i make the onkeypress with a keycode in javascriptkey press event json keypress inputaddeventlistener keypressdownhow to know key pressed in javascriptcheck key pressed jshtml keypressjavascript keypress onlinejavascript onkeypress eventkeypress in javascript onkeypressjavascript keypress event objectcheck keyvode onkeypress in htmlhow to attach a key press to webpagehtml key press eventchanging event onkeypress to buttonjavascript key is pressedget which key pressed javascripthow to pressed keys on click in jsjs keypress listenerknow the time a key is pressed jsonkeypress similar htmlhow to use onkeypress in javascriptadd event listener javascript keypresstext box onkeypress event javascriptpress key on keyboard javascriptkerpress event listenerjs read input keyshow to check for keystrokes javascritadd key events javascripthow to check if a key is being pressed javascriptkeypress event which keyhow to have a key press as an input in javascriptjs onkeypressjs key pressdetect keypress in javascriptkey pressed html js last key pressed jskeyboard input in htmlkeypress jshow to have js check for key pressonkeypress exampleson keypresshtml form input keystroke eventis there a keypress listenerdetect key press htmlidentify key pressed javascripthow to get key event in javascriptjavascript on key inputhow to take keyboard input in javascriptjs what key is presshow to get key press jsdetect when key is pressed javascriptform onkeypresskey pressed htmladding event listener to keypressrun code on keypress javascriptdom keypress eventhow to check if any key is pressed in javascriptjavascript add event listener keypresshow to detect a key pressed jsadd keypress event javascriptjavascript event for keypresskey presses jscall a function on key press jsevent listener for keypress in js listen for keypress in js all the timehow to use keys functions in htmlkeypress javascript examplehow to make keyboard pressed in javascriptinput on keypressjavascript code using onkeypress event javascript key pressjs keypress codejavascript keypress eventhtml event by press keyjs keyboard events keypressdetect which key is pressed javascriptkey press and onclick javascriptdocument keypressonkey press jestcss input key eventinput onkeypressjs do key pressfind key pressed javascriptevent on keypressusing javscript to press a keyhow to create an event listener for keypress javascriptevent handler in keypress jsdocument onkeypress javascriptjavascript keyboard key pressjavascript input keyboardadd event listener keypresskeypress on javascriptjavascript input onkeypressknow which key is pressed jshow to know what key was pressed for event in javascriptinput key jsdocument e key pressed jsdo something before key is pressed in jshow to find out which key is pressed in jsdetect key in javascripton keypress documentif key f is pressed in jsjavscript keypresshow to capture a keyboard key in javasciptjavascript check which key is pressedkeyboard input jsjavascript listen for keypress in htmladdeventlistener key pressjavascript listener keypressinput on key press jswhen enter key is pressed jskeypress javascript key codeswhen enter is pressed javascriptkeypress html tutorialonkeypress event in htmlhow to check key pressed in javascripthtml keypress eventsyntax for event listener on specific key presson keypress in nodejswhen key pressed javascripthow to create keypress event in javascripthtml on press keyfor keyboard press jsget key press event json keypress e javascriptkey press js on keyjavascript how to read if key is pressedjs on function on keypressfunction for keyboard inputs in htmldocument onkeypress eventevent listener for keypressjavascript 60 keypressjs keypress event listenerjs event key pressevent when key is pressed javascripthtml input onkeypressdocument keylistener 3d 28 27keypress 27 2c event 29 jsbutton keypress event javascripthow to detect when a key is pressed in javascriptkeypress is which eventhow to access key stroke javascriptkeypress listener jshow to get key pressed in javascriptchecking keypress javascriptkeypress event javascriptjavascript keypress controlevent keypressedjavascript if e key is pressedkeypress javascript eventkey presswhen keypress json key press input js listen for keypress in js all the timejs keypress onecheck key input in htmlhtml on key pressdhandle keypress event javascriptjs while key is pressednot display the key pressed key in js in input texthow handle key press jshow to check what key is pressed javascriptevent keypress javascriptlisten to keypress javascriptwhen enter key is pressed javascriptcheck for keyboard input javascripthtml input keypressjs keypress show to add function on keypress javascriptaddeventlistener keypress in javascriptchar key in jsjs get pressed keyjavascript is key pressedget the value of a pressed key jsonkeypress js eventif a key is pressed javascripton key press htmlkeypress event jskey press event in javascriptcall function when enter key is pressed javascriptget the current key being presed jsjs add event to keypresskeyboard input javascripthow to make a keypress in js with event listenerhow to make a key input jskeypress event in js with examplehow to display which key was pressed javascripthow to detect key pressed in javascriptpress key with javascriptkey press html 27html onkeydownjs detect keypress search on key press in javascriptjavascript check key presskeypress events in jsonkeypress in jsjavascript check for keypressinput onkeypress htmljavascript keypress to textjavascript on specific key presswindow on keypress javascripteverything about keypress in jsevent code on keypresskeypress event mdnonkeypress examplewindow event listener keypresshow to add add key pressed key in javascriptjavascript button on key pressonkeypress inputjavascript add keypress event listenerjs detect which key presseevent listener keypressfunction on keypress javascriptlisten to key press jsjs on key presshow to check if key was pressed jsonkeypess jsonpresskey javascriptdetect key press js examplehow to know what keys are clicked in html javascriptjavscript detect keypressevent listener for key pressjavascript element keypresskey pushed jsjavascript all key pressedjs check pressed keyjs key press eventon keypress specific w3schoolsonkey event in html buttonkeypressjs press key on inputwhat is the key of an textbox in htmljavascript function event keypresswebsite event on keypressspecific key press javascript eventkey press htmljavascript get keypressespress keys in jsdev mozilla keypressusing key press with jsjs keyboard inputeventlistener javascript keypressjs detect which key was pressedkeyboard keypress event in javascriptkeypresed jshow to get keypress javascriptkeypress addeventlistenerkeypress javascript