I'm having some difficulties with the standard jQuery features when I use Meteor. My main "client / server" JS file is as follows:
if (Meteor.is_client) {
$(document).ready(function(){
$('#myDiv').append("foo");
console.log('bar');
});
}
When I download the application, the "bar" logs are fine, but .append does not work. If I call the same .append in the console after the page loads, it works fine. (Similarly, if I run the same code in a setting other than Meteor, it also works fine.)
The code I really want to run is as follows:
$(document).ready(function(){
var myModel = new MyModel({"name": "foo"});
var myModelView = new MyModelView({model: myModel});
});
var MyModel = Backbone.Model.extend({
initialize: function() {
}
});
var MyModelView = Backbone.View.extend({
el: $('#myEl'),
initialize: function(){
_.bindAll(this, 'render');
this.render();
},
render: function(){
$(this.el).append(this.model.get('name'));
console.log(this.model.get('name'))
}
});
, , . console.log , jQuery append . , - , Backbone, , , Meteor/jQuery?