<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-debug.js"></script>
<label>
I'm a checkbox with a checked binding<input type="checkbox" data-bind="checked: isChecked"/>
</label>
<div>
Is the checkbox checked? <span data-bind="text: isChecked"></span>
</div>
<label>
I'm a checkbox trying to use the `checked` binding as an event binding
<input type="checkbox" data-bind="checked: itsBeenChecked"/>
</label>
JavaScript
var vm = {
isChecked: ko.observable(true),
itsBeenChecked: function() { aler("It's beed checked!"); }
};
ko.applyBindings(vm);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.