Search code examples
jquery-templates

JQuery Templates: pass parameter into a function


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?


Solution

  • You can access Field1 directly without using ${, like:

    <td>${functionX(Field1)}${Field2}</td>