Created
May 31, 2016 12:34
-
-
Save charmainetham/df1f3e0012ce9ac31b05a8821ef0f0bc to your computer and use it in GitHub Desktop.
event handling examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<form> | |
First name:<br> | |
<input type="text" name="firstname"><br> | |
Last name:<br> | |
<input type="text" name="lastname"> | |
</form> | |
</body> | |
</html> | |
<!-- | |
When your cursor is in the input and you press the SHIFT key, what events get triggered? Is keypress one of them? Why or why not | |
nothing happens because keypress only works for character keys only and shift is not one of them | |
holding shift and A together triggers keydown, keypress and then keyup on the time of releasing. | |
delete is keydown and keyup on time of release | |
tab initiates focus event focus in on the other input and focus out on the initial input. Clicking the input has the same effect focus out on the one not clicked and focus in on the one that was clicked. It is different as by clicking you are specifying which input you want to focus on but with tabbing it selects based on order. | |
for drag and drop it is the DragEvent followed by the drop event. they have the same DragEvent interface | |
touch event occurs when the user touches thescreen but click even is when the pointing device button is pressed(mouse) | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment