Reputation: 1161
I am having trouble testing knockout in js fiddle.... I believe I have it setup correctly but the results are not correct. Here is the fiddle to what I am working on... just trying to do basic data-binding.
html code:
name <input type="text" data-bind="value: name" />
<p>
Hi there <span data-bind="text: name"></span>
</p>
knockout:
$(function() {
var viewModel = {
name: "Edgar"
};
ko.applyBindings(viewModel);
});
The output doesnt show the name... cant figure out why. What am I doing wrong here?
Upvotes: 1
Views: 240
Reputation: 1154
don't see any issue in code
update fiddle to different CDN - https://cdnjs.com/libraries/knockout and add jquery CDN https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js
updated fiddle
$(function() {
var viewModel = {
name: "Edgar"
};
ko.applyBindings(viewModel);
});
Upvotes: 2