My index.html
include two javascript codes which are plugin.js
and main.js
(main include after plugin),
I want to make plugin.js
as a reusable plugin, like checking if the index.html
file has any elements which have click-me
class attribute, if index.html
has this kind of elements, then set every this kind of elements an eventListener.
I want my window.onload
function ALWAYS in main.js
rather than plugin.js
, but in this case I cant' get DOM object by className in plugin.js
, I also don't want to call any function of plugin.js
in main.js
.
Does anyone ahs any idea?