Taking input from inside handlebar .hbs file

耗尽温柔 提交于 2019-12-08 07:39:12

问题


I have code inside a .hbs file like this

{{ # each content }}

.....

 <input name = "a" type="text" id="a_id" /> 
 <button onclick="my_fn(a)"> BUTTON </button>
{{/each}}

Inside the code I have defined a button clicking which I want to call

another function:

function my_fn(a){
   alert("Hi"+ a);
}

where "a" is the user input. This way I'm unable to send argument to "my_fn". How this can be done.

来源:https://stackoverflow.com/questions/37837450/taking-input-from-inside-handlebar-hbs-file

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