0

Can someone tell me about the DOM and EVENTS in javascript....

i am facing some problems to understand DOMS AND EVENTS..

14th May 2018, 2:41 AM
Rudransh Sharma
1 Odpowiedź
+ 2
hi, An event is a system when certain actions performed are recorded and can be acted upon. Such as clicking on a button, hovering over some box, selecting some text, or even receiving a new message on a certain channel. In js, DOM events are standard events that correspond to actions performed directly on an element in the DOM such as when the user clicks on something, the click event(directly corresponding to the user clicking the button) is triggered and any event handlers attached to the element will be called. Here's a list of events:https://en.wikipedia.org/wiki/DOM_events These are recognized and supported by the browsers and are natively triggered. Many js libraries make their own system of events over these DOM events. They wrap around the element that is listened to and when an event is triggered, they propogate the event to the handling function They can also support custom events on DOM or any other object by having the user call a specific function such as obj.on("receive", function(){alert("Hello")}) //Later obj.trigger("receive") So the anonymous function(display an alert) will be called whenever you trigger the receive event. What happens here is that the on function will keep a list of handlers attached to the object and the trigger function will call each one and call them using any required data
14th May 2018, 2:48 AM
Rajeeb