I followed one of the basic tutorials on the knockout.js website and now I'm just trying to make it work on localhost. In the head, I have included two files: knockout.js and misc_form.js.
<head>
<script src="/knockout.js"></script>
<script src="/misc_form.js"></script>
</head>
I'm going to omit the code for misc_form.js because I didn't modify it and it works 100% on the live knockout.js tutorial.
Here's the HTML
//form.php
function display_form(){
?>
<table>
<thead><tr>
<th>Passenger name</th><th>Meal</th><th>Surcharge</th><th></th>
</tr></thead>
<!-- Todo: Generate table body -->
<tbody data-bind="foreach: seats">
<tr>
<td><input data-bind="value: name" /></td>
<td><select data-bind="options: $root.availableMeals, value: meal, optionsText: 'mealName'"></select></td>
<td data-bind="text: formattedPrice"></td>
<td><a href="#" data-bind="click: $root.removeSeat">Remove</a></td>
</tr>
</tbody>
</table>
<button data-bind="click: addSeat">Reserve another seat</button>
<?
}
Edit - I changed the path to the files and now I'm getting the following error
Uncaught TypeError: Cannot read property 'nodeType' of null //in reference to knockout.js