reading-notes


Project maintained by mr-atta Hosted on GitHub Pages — Theme by mattgraham

EVENTS

EVENTS (JS)

TERMINOLOGY

EVENTS in JS

There are so many different EVENT types you can use them in your code.

HOW EVENTS TRIGGER JAVASCRIPT CODE

EVENT TO ELEMENT

THREE WAYS TO BIND AN EVENT TO AN ELEMENT

  1. HTML EVENT HANDLER ATTRIBUTES

    • This approach is now considered bad practice. HTML EVENT HANDLER ATTRIBUTES
  2. TRADITIONAL DOM EVENT HANDLERS

    • All modern browsers understand this way.
    • But you can only attach one function. TRADITIONAL DOM EVENT HANDLERS
  3. USING DOM EVENT HANDLERS

    • If you use a named function when the event fires on your chosen DOM node, write that function first.
    • The DOM element node is stored in a variable. Here the text input (whose id attribute has a va lue of username) is placed into a variable called e 1 Username.

EVENT LISTENERS

EVENT LISTENERS

What Are Event Listeners?

Event listeners are among the most frequently used JavaScript structures in web design. They allow us to add interactive functionality to HTML elements by “listening” to different events that take place on the page, such as when the user clicks a button, presses a key, or when an element loads.

Event Flow

DIFFERENT TYPES OF EVENTS

LOAD

Form (HTML)

Form

ADDING TEXT:

Making Choices:

Submitting Forms:

Uploading Files:

How Forms Work ??

Forms

Summary