问题
This works:
<input type="checkbox" {{if (ON) }} checked {{/if}} id="cbCentral" />
This doesn't work:
<input type="checkbox" {{if (ON && QC) }} checked {{/if}} id="cbCentral" />
It seems && cannot be used to represent an AND operator. How can I express an AND operator? ON and QC are type boolean.
回答1:
This should work:
{{if ON && QC}}checked{{/if}}
I threw together a simple test using AND in an {{if}}
here: http://jsfiddle.net/Encosia/vNXV5/
来源:https://stackoverflow.com/questions/5332040/jquery-template-creating-a-conditional-statement-with-and-operators