JSFiddle - React, Tailwind, and code Playground

by zainshaikh

HTML

<ul data-bind="foreach: months">    
    <li>        <b data-bind="text: $data"></b>
    </li>
</ul> 
<ul>
        <!-- ko foreach: excluded_domains -->
    <li><a data-bind="text: $data"></a>
    </li>
    <!-- /ko -->
</ul>
<button data-bind="click: exclude_domain">Exclude</button>

JavaScript

function ViewModel() {
    var self = this;
    this.months = ko.observableArray(['Jdan', 'Feb', 'Mar', 'etc']);


    this.excluded_domains = ko.observableArray(["google.com", "yahoo.com"]);

    this.exclude_domain = function () {
        self.excluded_domains.push("google.com")
    }

}

ko.applyBindings(new ViewModel());