I have a JsRender template. When template is rendering I want to call a JavaScript function to manipulate some data.
Here is my JsRender template.
<tr class="template-download">
<td class="size">
<span>{{:size}}</span>
</td>
</tr>
Now I want to pass :size
value to JavaScript function and get the return value. So I can show return value instead of :size
value.
My JavaScript function is
function getSize(size) {
var megabytes = size / (1024 * 1024);
return megabytes.toFixed(2) + "MB";
}
How can I do this?