JSFiddle - React, Tailwind, and code Playground
by S1l3
HTML
<a href="#clock">clock</a>
<a href="#calendar">calendar</a>
JavaScript
window.clock = {
init : function(){return this;},
load : function(){
alert("once clock ");
},
once : function(){
alert("load clock ");
}
};
window.calendar= {
init : function(){return this;},
load : function(){
alert("once calendar");
},
once : function(){
alert("load calendar");
}
};
clock.load()
calendar.load()
$("a").click(function(){
var id = $(this).attr("href").match(/[a-zA-Z]+/g);
window[id].once();
})