This content originally appeared on DEV Community and was authored by Aya Bouchiha
Hello,
I'm Aya Bouchiha,
today, we'll discuss 5 input events that you will use at least one of them in your next projects.
firstly, we need to know that handling events can be done with:
onEventName
example:
showButton.onclick = handleClick;
addEventListener('eventName', function)
example:
showButton.addEventListener('click', handleClick)
- The event as a attribute (
onEventName="function()"
)
<button onclick="doSomething()"></button>
blur and focus
focus: This happens when the user focuses on the input field.
blur: happens when the user leaves the input field.
input
input: This happens immediately when the user changes the input's value.
reset
reset: This happens when a form is reset by clicking to a reset input or a reset button.
submit
submit: This happens when a form is submitted, by clicking a submit button or a submit input.
Summary
- focus happens when the user leaves the input field.
- blur: happens when the user focuses on the input field.
- input: happens immediately when the user changes the input's value.
- reset: happens when a form is reset.
- submit: This happens when a form is submitted.
References
References
Suggested Posts
To Contact Me:
- email: developer.aya.b@gmail.com
- telegram: Aya Bouchiha
Happy codding!
This content originally appeared on DEV Community and was authored by Aya Bouchiha
Aya Bouchiha | Sciencx (2021-08-05T00:30:31+00:00) 5 Input Events That You Will Use At Least One Of Them In Your Next Projects.. Retrieved from https://www.scien.cx/2021/08/05/5-input-events-that-you-will-use-at-least-one-of-them-in-your-next-projects/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.