メインメニューを開く

差分

Knockout.js

5 バイト除去, 2012年4月10日 (火) 07:53
<head>
<meta charset="UTF-8">
<title>Knockoutjs knockout.js - Test01Test02</title>
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="knockout-2.0.0.js"></script>
 
<script type="text/javascript">
jQuery(function() {
// ready関数
// knockoutjsはDOMが準備されてからじゃないと動かないよ。
// モデル
var function AppViewModel = function() {
// observable
this.firstName = ko.observable("Mono");
return this.firstName() + " " + this.lastName();
}, this);
};
// バインディング
ko.applyBindings(new AppViewModel());
})();
</script>
 
</head>
<body>
<p>First name: <input data−binddata-bind="value: firstName" /></p> <p>Last name : <input data−binddata-bind="value: lastName" /></p> <p>Full name : <strong data-bind="text: fullName"></strong></p>
</body>
</html>
匿名利用者