JSFiddle - React, Tailwind, and code Playground

JavaScript

var phantom = document.createElement("div")
var foo = document.createElement("div")
var button = document.createElement("button")
document.body.appendChild(button)
document.body.appendChild(phantom)
document.body.appendChild(foo)

button.textContent = "test"
button.onclick = function() { 
    $(phantom).trigger("test")
}

$(phantom).on({
    "test": function() {
        foo.textContent += "one"
    }
})
$(phantom).on({
    "test": function() {
        foo.textContent += "two"
    }
})