Insert helpers via jquery


#1

Hello,

I want to insert in a template a button via JQuery :

$(selector).closest('.player').append("<button class='btn btn-success btn-sm playerValidation' id='{{validationButton}}' type='button'>{{_ 'validate'}}</button>"); 

Where {{validationButton}} is an helper like this :

'validationButton': function() {return this.team + this.jersey + 'validation';}

And {{_ ‘validate’}} is a label for translation

But when I go into the app JQuery insert the button litteraly, and Meteor doesn’t render the helper and the label.

How can I make Meteor render the helper and the label ?


#2

If you want to use handlebars syntax, you need to put that code in a template and use Blaze.toHTML, or a similar function.