Reputation: 1449
Im trying to use some jQuery in my Meteor app, but the jQuery below
Meteor.startup(function(){
$('#new-list-button').on('click', function(ev){
console.log('clicked');
})
});
runs before the #new-list-button
element loads on the page.
Upvotes: 0
Views: 177
Reputation: 448
Template.example.events({
'click #new-list-button':function(event){
$('yourElem').addClass('yourClass');
}
});
Jquery works inside meteor events, you just have to look at it differently as opposed to on.click
Upvotes: 0
Reputation: 11376
Well actually thats an on click event
Meteor have his own event handlers
Template.example.events({
'click #new-list-button':function(){
console.log('clicked');
}
})
Take a look into Templates.events docs
FYI if you want to use jQuery plugins on meteor i suggest you to use the rendered function.
For example
Template.example.rendered = function(){
initializePlugin();
}
Upvotes: 1