Created
February 9, 2016 13:10
-
-
Save kakikubo/5fb085cfd3dcc2c67b7e to your computer and use it in GitHub Desktop.
knockout.jsの簡単なサンプル。enable binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="./knockout.js"></script> | |
</head> | |
<body> | |
<p> | |
<input type="checkbox" data-bind="checked: hasCellphone" /> | |
携帯電話をもっている | |
</p> | |
<p> | |
電話番号: | |
<input type='text' data-bind="value: cellphoneNumber, enable: hasCellphone"/> | |
</p> | |
<script type="text/javascript"> | |
var viewModel = { | |
hasCellphone : ko.observable(false), | |
cellphoneNumber : "" | |
}; | |
ko.applyBindings(viewModel); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment