JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://andersmalmgren.github.io/Knockout.BindingConventions/src/Knockout.BindingConventions.js"></script>
<input data-name="enable" />
JavaScript
ko.bindingConventions.conventionBinders.inputEnable = {
rules: [function(name, element, bindings, unwrapped, type) { return type === "boolean" && element.tagName === "INPUT"; }],
apply: function(name, element, bindings, unwrapped, type, data) {
bindings.enable = data;
}
};
ko.bindingConventions.conventionBinders.input.rules.push(function(name, element, bindings, unwrapped, type) { type !== "boolean" });
MyApp = {};
MyApp.TestViewModel = function() {
this.enable= ko.observable(false);
};
ko.applyBindings(new MyApp.TestViewModel());