These events by default use bubbling propagation i.e, upwards in the DOM from children to parent. We can bind events either as inline or in an external script.
1) onclick events: This is a mouse event and provokes any logic defined if the user clicks on the element it is bound to.
Before clicking “click me event” key-
After clicking “click me event” key-
2) onkeyup event: This event is a keyboard event and executes instructions whenever a key is released after pressing.
Before written of “gfg”-
After written of “gfg”-
3) onmouseover event: This event corresponds to hovering the mouse pointer over the element and its children, to which it is bound to.
Before mouse is taken over green square-
Green square gets disappear after mouse is taken over it.
4) onmouseout event: Whenever the mouse cursor leaves the element which handles a mouseout event, a function associated with it is executed.
Before mouse is taken over the green square-
Green square will disappear after mouse is taken over it and removed after some time.
5) onchange event: This event detects the change in value of any element listing to this event.
Before any key is pressed-
After 2 key is pressed-
6) onload event: When an element is loaded completely, this event is evoked.
7) onfocus event: An element listing to this event executes instructions whenever it receives focus.
Before mouse is clicked inside of the box-
After mouse is clicked inside of the box-
8) onblur event: This event is evoked when an element loses focus.
Before “gfg” is entered inside of the box-
After “gfg” is entered inside of the box and pressed enter-
PS: onmouseup event listens to left and middle mouse click, but onmousedown event listens to left, middle, and right mouse clicks whereas onclick only handles left click.