JSFiddle - React, Tailwind, and code Playground

HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<button data-bind="click: addTemplate">Add Template</button>
<button data-bind="click: doAlert">Test Alert</button>

<script type="text/html" id="MyTemplate">
    <div id="container">
        <a href="#" data-bind="click: $root.doAlert">Do Alert</a>
    </div>
</script>

CSS

#container
{
    background-color: grey;
}

JavaScript

function MyViewModel()
{
    self = this;
    
    self.addTemplate = function () {
        $($("#MyTemplate").html()).appendTo("body");
    }
    
    self.doAlert = function() {
        alert('Hello World');
    } 
}

ko.applyBindings(new MyViewModel());