日期:2014-05-16  浏览次数:20432 次

问一个Backbone的JS问题
我在学习Backbone,按自己的想法写了一个demo,但是添加功能没有起作用,代码如下,麻烦大家看看是什么问题。

HTML部分:
    
<div id="container">
        <h1>Backbone demo</h1>
        <div>
            <input id="firstName" placeholder="First Name" />
            <input id="lastName" placeholder="Last Name" />
            <select id="city">
                <option>New York</option>
                <option>Los Angeles</option>
                <option>Chicago</option>
                <option>Houston</option>
                <option>Philadelphia</option>
                <option>San Francisco</option>
                <option>Washington</option>
                <option>Las Vegas</option>
            </select>
            <input id="job" placeholder="Job" />
            <button id="add">Add new item</button>
        </div>
        <div>
            <table id="dataList" style="border:solid 1px #aaa; border-collapse:collapse;">
                <tr>
                    <th>Id</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>City</th>
                    <th>Job</th>
                    <th>Action</th>
                </tr>
            </table>
        </div>
    </div>
  &nbs