javascript - Jquery tmpl 创建一个或语句

标签 javascript jquery jquery-templates

{{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 模板中不起作用..

最佳答案

代替:

{{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)

关于javascript - Jquery tmpl 创建一个或语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17238132/

相关文章:

javascript - 仅在 onclick 之前触发 href 事件

java - 如何使用属性文件通过 struts2 更改 jquerytheme

javascript - 根据字段值呈现内部 jquery-template

javascript - 在 iframe 中打开新窗口链接

javascript - 为什么我的代码执行的次数比预期的要多?

jquery - 如何在jquery中使用不同的值多次调用函数

javascript - 如何使用 Ajax 和 Servlet 上传文件

javascript - 动态加载 jQuery 模板

javascript - jQuery 模板循环计数器

javascript - 如何在更改 d3.js 中数据的函数调用之间添加延迟?