jQuery template: Creating a conditional statement with AND operators

折月煮酒 提交于 2020-01-04 05:30:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!