JSFiddle - React, Tailwind, and code Playground

by naveenkumarm

HTML

<div id="a" data-bind="html: code">
    this text is replaced by the JavaScript
</div>
</br>
 <span data-bind="click: changeClicked" style="color:red;">Change</span>

JavaScript

function AppView() {
    var self = this;
    self.code = ko.observable('<div>this shouldnt show</div>');
    self.stuff = ko.observable('this should show');

    
     self.changeClicked = function(){
     app.code('<div data-bind="text: stuff">this shouldnt show either</div>');
     }
}

var app = new AppView();
ko.applyBindings(app);

// Later
//app.code('<div data-bind="text: stuff">this shouldnt show either</div>');