车把模板中的onblur函数调用 [英] onblur function call in handlebar template
本文介绍了车把模板中的onblur函数调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在将值传递给在车把模板的onblur事件内部调用的函数时遇到问题.
I am having problem passing value to a function called inside onblur event of handlebar template.
<div class="property" id="property">
<span class="innertitle">Property/Site Details</span></br>
<table id="propDetails" width="400" border="0">{{#dispycolumns}}
<tr>
<td>{{FieldLabel}}</td>
<td>
<input name="{{fieldName}}" type="text" value="{{FieldValue}}" maxlength="100" onblur="validateFields(this.value,this.name,{{FieldLabel}});" />
</td>
</tr>{{/dispycolumns}}
</table></br></br>
</div></br></br>
<input style="font-size:12px;float:right;margin-top: -19px;margin-left: 59px;background-color:#0099FF;" type="button" name="Next" value="Next" onclick="savePropertyDetails();loadConsumptionData()" />
在上面的代码中,我正在调用带有3个参数的validateFields()函数.我在传递第三个参数{{FieldLabel}}时遇到问题.我需要用单引号将其正确编译. 请求帮助.
In above code i am calling validateFields() function with 3 arguments.I have a problem passing the third argument {{FieldLabel}}. I need single quotes around it to properly compile. Request help in doing it.
推荐答案
您必须在要用作字符串文字参数的{{FieldLabel}}周围加上引号:
You must wrap quotation marks around {{FieldLabel}} where it is intended to be a string literal argument:
onblur="validateFields(this.value, this.name, '{{FieldLabel}}');"
这篇关于车把模板中的onblur函数调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文