I have a simple ng-click button nested inside ng-repeat and there're no <form>
in current page.
<tr ng-repeat="product in catalog | limitTo: total track by $index" ng-class="{highlight: product==selected}">
<td class="highlight-hide">
<div ng-if="canDoSelfOrdering">
<button class="btn btn-mini" ng-click="callPricing(product)">Price & Order</button>
</div>
</td>
<!-- other td -->
</tr>
when the catalog array updated and user pressed ENTER without focus on any inputs. the last button element ng-click="callPricing(product)"
trigger unintentionally.
i tried watch document.activeElement before hitting Enter key it's <body>
How to prevent this?
Internet Explorer documentation says that in IE8 Standards mode, the default button value is submit.
If the ENTER key is pressed while a user is viewing a form that contains a Submit button, the form is submitted.
Although you do not have any forms to submit, i guess IE8 does not check that. Just try writing your button type as button explicitly .
<button type="button" class="btn btn-mini" ng-click="callPricing(product)">Price & Order</button>
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.