Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJAKZ AIZZAT
7,813 PointsWhat's different between this?
What's different between keypress ,keyup and keydown?
Its looks same
2 Answers
Michael Hulet
47,913 Pointskeyup triggers when the user lets their finger off of a key, keydown triggers when the user presses a key, and keypress fired when a user presses a key, but keypress excludes keys that don't print anything to the screen, like the shift or esc
Michael Hulet
47,913 PointsYes. For example, using keyup, if you held down on a key, the code you wanted to run wouldn't run until you let go of the key, but the code will run as soon as you put your finger on the key if you use keydown. keypress works exactly the same as keydown, except it includes non-printing keys like Shift or esc
JAKZ AIZZAT
7,813 PointsThanks for your explanation :D I understand now.
JAKZ AIZZAT
7,813 PointsJAKZ AIZZAT
7,813 PointsSo, keyup when user finish insert key, keydown when user entering key, keypress same with keydown but not include key that doesnt show on screen(Ctrl,alt, and etc)