简体   繁体   中英

onblur function call in handlebar template

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.

您必须在要用作字符串文字参数的{{FieldLabel}}周围加上引号:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM