0
我是新来的胡子,我正在使用它的网站上工作。我在这个网站的一个文件夹中有一组胡须模板。他们被称为与Sekizai标签在主HTML这样的:胡子包含模板
<html>
<head>...</head>
...
<body>
{% block body_content %}{% endblock %}
{% mustachejs "dashboard_module" %}
{% mustachejs "dashboard_add_module" %}
{% mustachejs "dashboard_empty_module" %}
{% mustachejs "login_popup" %}
{% mustachejs "add_account_types_popup" %}
{% mustachejs "add_account_manual_popup" %}
{% mustachejs "add_account_success_popup" %}
{% mustachejs "chart_linearprogress" %}
{% mustachejs "adviser_popover" %}
{% mustachejs "add_event_popup" %}
</body>
</html>
这将产生脚本标签,如:
<script>Mustache.TEMPLATES=Mustache.TEMPLATES||
{};Mustache.TEMPLATES['add_event_popup']='<div id="AddAccountsPopup" class="add-event-popup">\n
<div class="addAccountsContainer">\n ... </script>
现在在另一个js文件我想在点击事件,在这些模板之一,如:
function my func(){
var evnt_btn = $('.add-evnt-btn');
var template;
// get mustache template
template = $(Mustache.render('add_event_popup'));
evnt_btn.click(function(){
template.show();
});
}
什么是myfunc()当然不工作!我怎样才能做到这一点?