JSFiddle - React, Tailwind, and code Playground

by Danny Michaelis

HTML

<div class="div">div</div>

JavaScript

function do_something() {
    alert("Button" + this.class + " is pressed");
}

var button_a = $("<button />", {
    text: 'A',
    click: do_something,
    class: "button a"
});

var button_b = $("<button />", {
    text: 'B',
    click: do_something,
    class: "button B"
});

$(".div").append(button_a);
$(".div").append(button_b);