The following code returns an error "Uncaught ReferenceError: size is not defined" in Chrome if variable size is not defined:
<script type="text/x-jquery-tmpl">
{{if name && size}}
<p>${name}</p>
<p>${size}</p>
{{/if}}
</script>
While this code works fine :
<script type="text/x-jquery-tmpl">
{{if name}}
{{if size}}
<p>${name}</p>
<p>${size}</p>
{{/if}}
{{/if}}
</script>
Can I somehow make it work in Chrome without using double if statement and why does it return an error at all?
try this:
<script type="text/x-jquery-tmpl">
{{if name && size != null && size}}
<p>${name}</p>
<p>${size}</p>
{{/if}}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With