Knockout Foreach demo

HTML

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
 <div id="menutab">
    <form id="createMForm">
        <input type="button" id="createmenu" value="Add menu" data-bind="click: addCourse"/>
        <div class="menu">
            <table data-bind="foreach: cources" class="ui-widget ui-widget-content" >
                <tr>
                    <td>
                        <label for="CourseName">CourseName</label>
                    </td>
                    <td>
                        <input type="text"  data-bind="value: textValue, valueUpdate:'keyup'" class="CreateCourseName" name="CourseName" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<div id="courseoptiontab">
    <form id="createCOForm">
        <div class="options">
            <table data-bind="foreach: cources" class="ui-widget ui-widget-content">
                <tr>
                    <td>
                        <label class="colabel">Course Name 
                            <span class="forcourse" data-bind="text: $index"></span>
                        </label>
                    </td>
                </tr>
          </table>
       </div>
    </form>
<div>

JavaScript

function CourseViewModel(){
    var self = this;
    self.textValue = ko.observable(''); 
}

function CeremonyViewModel() {
    var self = this;
    
    self.cources = ko.observableArray([new CourseViewModel()]);
    
    self.addCourse = function(){
        self.cources.push(new CourseViewModel());
        self.cources.push(new CourseViewModel());
        self.cources.push(new CourseViewModel());
        self.cources.push(new CourseViewModel());
    };
}

ko.applyBindings(new CeremonyViewModel());