【问题标题】:Jquery tmpl creating a or statementjQuery tmpl 创建 or 语句
【发布时间】:2013-06-18 18:08:01
【问题描述】:
{{if production_country != null || production_year != null}}
    <h3 class="heading">Details</h3>
    <p><b>${production_country} ${production_year}</b>, {{html roles}}</p>
{{/if}}

如何创建 OR 语句。这在我的 jquery 模板中不起作用..

【问题讨论】:

  • 我有 2 个变量“生产年份”和“生产国家”。当其中一个变量为空时,我不想在段落中显示标题。我如何在我的 jquery 模板的 if 语句中做到这一点?当我使用管道'||'时它总是显示错误

标签: javascript jquery jquery-templates


【解决方案1】:

代替:

{{if production_country != null || production_year != null}}

用途:

{{if production_country !="" OR production_year !=""}}

我不确定您是否需要确定 production_country 和 production_year 的值。例如 production_year.value!=""

看到这个问题:

jQuery: checking if the value of a field is null (empty)

【讨论】:

    猜你喜欢
    • 2013-03-05
    • 1970-01-01
    • 1970-01-01
    • 2011-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 1970-01-01
    相关资源
    最近更新 更多