Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
2 of 6
edited tags
Shog9
  • 160.1k
  • 36
  • 237
  • 242

What is the event precedence in JavaScript?

What order of precedence are events handled in JavaScript?

Here are the events in alphabetical order...

  1. onabort - Loading of an image is interrupted
  2. onblur - An element loses focus
  3. onchange - The user changes the content of a field
  4. onclick - Mouse clicks an object
  5. ondblclick - Mouse double-clicks an object
  6. onerror - An error occurs when loading a document or an image
  7. onfocus - An element gets focus
  8. onkeydown - A keyboard key is pressed
  9. onkeypress - A keyboard key is pressed or held down
  10. onkeyup - A keyboard key is released
  11. onload - A page or an image is finished loading
  12. onmousedown - A mouse button is pressed
  13. onmousemove - The mouse is moved
  14. onmouseout - The mouse is moved off an element
  15. onmouseover - The mouse is moved over an element
  16. onmouseup - A mouse button is released
  17. onreset - The reset button is clicked
  18. onresize - A window or frame is resized
  19. onselect - Text is selected
  20. onsubmit - The submit button is clicked
  21. onunload - The user exits the page

What order are they handled out of the event queue?

The precedence is not first-in-first-out (FIFO).

dacracot
  • 22.5k
  • 28
  • 111
  • 160