How can i use onfocus, unload and onblur Events | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i use onfocus, unload and onblur Events

please explain me more about it with example. How can i use it in what elements of HTML these Events are mostly used.

1st Apr 2018, 2:40 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
4 Answers
+ 4
Ethan Franklin: With the .addEvetListener() method, the first argument is spelled without the 'on' prefix, only used on related html attribute name ;)
1st Apr 2018, 3:11 AM
visph
visph - avatar
+ 1
@Visph in Event Listener method example// div.addEventListener("click","myfunc"); why we are not using onclick why just click; if i do not you "on" and just write [change, blur, unload] is it going to work
1st Apr 2018, 3:09 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
+ 1
thanks i got it.
1st Apr 2018, 3:12 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
- 1
'onfocus', 'onblur' events are "mostly used" for <form> elements (mostly <input> elements)... 'unload' event is mostly used for <body> / document element... but could be used also on <img> element... How you can use them, and example of use are beyond the scope of Q&A answers: you must be more specific on your question ^^
1st Apr 2018, 2:54 AM
visph
visph - avatar