JSFiddle - React, Tailwind, and code Playground
by Admiral Potato
HTML
<h1>See console for output!</h1>
<button id="yup">!!!!</button>
JavaScript
var Slider = function(args) {
var t = this, type = 'Slider';
if(t.type !== type){ throw type + ' constructor requires the use of the `new` keyword.'; }
args = args || {};
t.color = args.color || '#f00';
t.element = args.element || document.createElement('div');
t.element.linkback = t;
t.$element = $(t.element);
t.$element.on('click', t.sliderClickListener);
t.$element.html('LOLCATS!');
$(document.body).append(t.$element);
};
Slider.prototype = {
type: 'Slider',
sliderClickListener: function(event){
var t = event.currentTarget.linkback;
console.log(t);
}
};
var mySlider = new Slider({
element: document.getElementById('yup')
});