如何检查handlebarjs中的输入长度

时间:2015-07-15 16:26:57

标签: javascript jquery handlebars.js

我检查了车把:

{{#if-condition classname '==' 'back-btn'}}
                         data-toggle="modal" data-target-tmpl="#testeest"
                         {{/if-condition}}

因此页面上有3或4个输入字段。 如果输入字段为空,我想再检查一下我现有的代码所以我希望它在 #if-condition

我愿意使用javacript或jquery

1 个答案:

答案 0 :(得分:0)

您应该根据“”或空字段检查输入值,如下所示:$('#whateverYourInputIdIs').val() == ""。例如,在常规jQuery中,我会像这样使用它:

if (classname == 'back-btn' && $('#myInputId').val == "") {
    //do things that happen when your classname is back-btn and the input id is empty
}
相关问题