JSFiddle - React, Tailwind, and code Playground

by Leo Cavalcante

HTML

<button id="btnum">botao um</button>

<button id="btndois">botao dois</button>

JavaScript

var TESTE = TESTE || {}

TESTE.objeto = {
    init: function () {
        this.btnUm = document.getElementById('btnum');
        this.btnUm.onclick = this.metodoUm;
        
        this.btnDois = document.getElementById('btndois');
        this.btnDois.onclick = this.metodoDois.bind(this, 'hello');
    },
    metodoUm: function () {
        alert('Ola');
    },
    metodoDois: function (parametro) {
        alert(parametro);    
    }
}

TESTE.objeto.init();