是否可以在tagName
中提供的標籤內添加另一個標籤?Backbone.js - 在li標籤內添加按鈕標籤
我有這樣的代碼:
BookView = Backbone.View.extend(
tagName: "li"
events:
"click .delete": "deleteBook"
deleteBook: (ev) ->
#delete operation /books/id
@book.destroy success: ->
router.navigate "",
trigger: true
而且我希望把未來每li
標記名內的按鈕,所以當有人點擊它,它會刪除該記錄。我怎麼能這樣做?
例如:
<ul>
<li>Some text <button type="submit">Delete</button></li>
</ul>