![](/img/trans.png)
[英]SugarCRM - How to add an onClick event to existing HTML / Checkbox
[英]How to add onclick event on checkbox in ember (hbs)
我已经被添加到项目与余烬。 不幸的是,我只知道AngularJS。 无论如何,我要做的是在复选框上添加onclick事件。 我尝试使用观察器,但没有成功(可能是因为输入是通过迭代生成的)。 继承人代码
{{#each prod in allProducts}}
<tr>
<td class="checkbox-event" selenium-id="check">{{input type=checkbox checked=prod.selected id=prod.id}}</td>
<td selenium-id="id">{{prod.productNumber}}</td>
<td selenium-id="name">{{prod.name}}</td>
<td selenium-id="category">{{prod.mainCategoryName}}</td>
<td selenium-id="price">{{prod.mainPrice}}</td>
</tr>
{{/each}}
我需要做的是在输入上添加click事件,该事件将使用prod
作为参数来调用某些函数。 我仅找到“正常”输入的答案,但没有找到以上答案。
您有几个问题:
each prod in allProducts
都是错误的。 使用{{#each allProducts as |prod|}}
type=checkbox
错误。 使用type="checkbox"
您可以使用change
操作。
查看此旋转链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.