addDelegateListener
Attach a handler for an event for all elements that match the selector, now or in the future, based on a root element.
addDelegateListener( target, eventType, selector, handler )
// Prevents all anchor elements from changing the page
domEvents.addDelegateListener(document.body,"click", "a", function(event){
event.preventDefault();
})
Parameters
- root
{DomEventTarget}
:The html element to listen to events that match selector within.
- eventType
{String}
:The event name to listen to.
- selector
{String}
:A selector to filter the elements that trigger the event.
- handler
{function}
:A function to execute at the time the event is triggered.