2
Code:
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='js/knockout-3.2.0.js'></script>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
<script type="text/javascript">
function AppViewModel() {
this.firstName = "Bert";
this.lastName = "Bertington";
}
ko.applyBindings(new AppViewModel());
</script>
<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
</body>
</html>
I’ve tried to put the
ko.applyBindings
to the end of html? I believe that at the time it runs, the twoinput's
have not yet been rendered, and then he does not find the elements to do thebinding
.– Wakim
It worked! Thanks!
– Faro