JQuery selection button attribute element
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()]")
Error displayed:
Error: syntax error, unrecognized expression: button [Ng-click: 'search ()]
Does jQuery support an attribute selector for a button element? I can achieve this $("button.btn-primary")
, but I don't think this is good enough.
How can I select a button element by its attribute?
+4
3 answers