My HTML:
<button class="btn btn-primary cl-width" ng-click="search()"> <i class="icon-search icon-white"></i> Search</button> <button class="btn cl-width" ng-click="criteriaModel.reset()"> <i class="icon> iconfa-undo"></i> Reset</button>
My jQuery:
$("button[ng-click:'search()]")
It shows an error:
Error: Syntax error, unrecognized expression: button [ng-click:'search()]
Doesn't jQuery support attribute selector for button element?
I can achieve that by $("button.btn-primary")
, but I don't think that is good enough.
How could I select a button element by its attribute?
Try
$("button[ng-click='search()']")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With