onblur function call in handlebar template

有些话、适合烂在心里 提交于 2019-12-11 14:52:41

问题


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()" />

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.


回答1:


You must wrap quotation marks around {{FieldLabel}} where it is intended to be a string literal argument:

onblur="validateFields(this.value, this.name, '{{FieldLabel}}');"


来源:https://stackoverflow.com/questions/22659961/onblur-function-call-in-handlebar-template

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