I have an edit box which accepts an email address on my html page.
At the moment, I have a javascript call 'onkeyup
' which verifies if the email address is OK.
And it works well while the user types.
However, if I start typing my address (We will use [email protected]
), and I start with:
me@
My autocomplete offers me '[email protected]', as I have used it before.
When I select that from the autocomplete drop down - 'onkeyup
' doesn't fire. Instead, 'onchange
' fires.
I need both to fire. As the suer types, I want to validate (onkeyup), but I need to also fire the javascript 'onchange'. I don't, however, think I should fire both events. Is there a way to handle both with a single event?
You can use oninput
event to combine onkeyup and onchange events. This event fires on pasting (ctrl+v) too.
<input name="title" oninput="func()">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With