user5858
user5858

Reputation: 1221

Unable to find JQuery selector

I've an element

 <a ng-if="summaryData.secondFactorType == 'NOAUTH'" class="m-r-xl cursorPointer pull-right m-t-sm cancelbtn ng-scope" ng-click="cancel('PAY_NOAUTH') ">Cancel</a>

I want a selector to locate this element using ng-click="cancel('PAY_NOAUTH')

I'm unable to create proper selector because JQuery is giving syntax error one way or other

Upvotes: 0

Views: 38

Answers (2)

CumminUp07
CumminUp07

Reputation: 1978

I noticed that you have a space after your ending parentheses, for me I needed to include the space in order for the selector to work or just remove the space from the html. This should work with the space

$('a[ng-click="cancel(\'PAY_NOAUTH\') "]')

and this without it

$('a[ng-click="cancel(\'PAY_NOAUTH\')"]')

Upvotes: 0

Louys Patrice Bessette
Louys Patrice Bessette

Reputation: 33933

You could use an attribute selector like this:

$("[ng-click='cancel(\"PAY_NOAUTH\")']")

Upvotes: 1

Related Questions