When applying bindings in knockoutjs explicitely to a specific DOM element, you may get this error:
Uncaught Error: ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node
Your HTML might look like this:
Whats wrong with it? Let's try document.getElementById instead:
Now everything works as expected:
So what's wrong with the jQuery way of selecting the DOM element?
When using var menu = $("#menu") we don't get a DOM object but a jQuery object instead.
To get the correct DOM element, we have to use one of the ladder two of the following (first one is for understanding purposes only):