1. Home
  2. Docs
  3. Web Technology I
  4. Markup Language (HTML)
  5. HTML Events

HTML Events

Here is the description of HTML Events:

  • HTML events are actions or occurrences that happen in the browser, such as a user clicking a button, moving the mouse, pressing a key, or the page finishing loading.
  • In HTML, events can be used to trigger JavaScript code, allowing developers to create interactive and dynamic web pages. Here are some commonly used HTML events:
  • onclick:
    • Fires when an element is clicked.
Screenshot 2024 03 03 190715

onmouseover and onmouseout:

  • Triggered when the mouse pointer enters or leaves an element.
Screenshot 2024 03 03 190749

onmousedown, onmouseup, and onmousemove:

  • Fired when a mouse button is pressed, released, or moved over an element.
Screenshot 2024 03 03 190811
  • onkeydown, onkeyup, and onkeypress:
    • Triggered when a key is pressed down, released, or pressed (respectively).
Screenshot 2024 03 03 191010
  • onsubmit:
    • Fired when a form is submitted.
Screenshot 2024 03 03 191117

onchange:

  • Triggered when the value of an input element changes.
Screenshot 2024 03 03 191132
  • onload and onunload:
    • Fired when the page finishes loading or unloading.
Screenshot 2024 03 03 191312

onresize:

  • Triggered when the browser window is resized.
Screenshot 2024 03 03 191321
  • onfocus and onblur:
    • Fired when an element gains or loses focus.
Screenshot 2024 03 03 191520

onchange:

  • Triggered when the content of an element, such as an input field, changes.
Screenshot 2024 03 03 191536
  • You can also define and trigger custom events in JavaScript using the CustomEvent constructor.
Screenshot 2024 03 03 191635

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *