PepeMo Talk Live!

Main Menu

All about events in Javascript

Started by Kavindu123, Jul 22, 2023, 04:32 PM

Previous topic - Next topic


Events means when the user enter into the webpage, clicking a element in the page by mouse, pressing a key. Identify a event and execute a process through it. In javascript this called listing to an event.

Also there are main 2 ways to listen to an event.
01. Throgh HTML Attributes.
02. addEventListener - ( "event", function() );

Mostly using events in JavaScript
  • Click
  • Mouseover
  • Keyup
  • Keydown
  • Change

Click event
It can process through 2 methods as
01. Through HTML attributes :
<button onclick = "alert('Button was clicked')"> clickme </button>

02. addeventlister :
<button id ="Clickme"> click me as well</button>

event when after pressing a key
document.addEventListner("keyup", function(event) {
 console.log(event);                              }

changing a value in a input

Thank you for reading my post. Please comment if you like