Reputation: 12188
So I have this JQuery template that calls a function:
<script id="Fred" type="text/x-jQuery-tmpl">
<td>${functionX()}${Field2}</td>
</script>
Works great. but now I want to pass a parameter into it, but the following won't work.
<script id="Fred" type="text/x-jQuery-tmpl">
<td>${functionX(${Field1})}${Field2}</td>
</script>
Any suggestions?
Upvotes: 4
Views: 4135
Reputation: 1
This is another example of how the problem could be solved:
<script id="testTemplate" type="text/x-jquery-tmpl">
{{if title.length}}
<h3>${title}</h3>
<p>Start: ${ render($data) } :End</p>
{{/if}}
</script>
You can see that this method works in this link.
Upvotes: -1
Reputation: 114802
You can access Field1 directly without using ${, like:
<td>${functionX(Field1)}${Field2}</td>
Upvotes: 8