Skip to content

Instantly share code, notes, and snippets.

View setDynamicListener.js
/**
* Set event listener on dynamic elements
*
* {@link https://www.yudhistiramauris.com/how-to-add-javascript-event-listener-on-dynamic-elements/}
*
* @param {string} type Event name
* @param {string} selector CSS/JS selector
* @param {Function} callback Function to execute upon event trigger
*/
function setDynamicListener( type, selector, callback ) {