registerhelper

Return html object from handlebars helpers

橙三吉。 提交于 2019-12-10 19:56:49
问题 I need to send an html object from handlebars helper as follow: Handlebars.registerHelper('helper', function () { //Create an input object var inp=$('<input type="text" name="name">'); //How to return 'inp' object without using Handlebars.SafeString return inp; }); I understand that I can return html string using ‘Handlebars.SafeString()’, however this is not useful to me I need to pass html object with some event assign to it. Is it possible? 回答1: As dandavis commented, using Handlebars you