2
我是Backbone JS的新學習者,遇到了問題。主幹JS - 獲取屬性
我在網頁上有一個按鈕。點擊按鈕後,屬性「味精」將於
<script>
var m = Backbone.Model.extend({
initialize: function(options){
console.log("A view item is created");
},
default: function(){
return{
msg: "hello world",
num: 1000
};
}
});
var v = Backbone.View.extend({
el: $("body"),
events: {
"click #b": "outputMsg"
},
outputMsg: function(model){
$("#d").append(model.get('msg'));
}
});
var test = new v;
</script>
輸出,但調試器顯示有上$問題(「#d」)。追加(model.get(「味精」)) ;
我該如何解決?謝謝!