1

I need to modify the following code (which works fine):

if ($("#cartable-items .cart-trigger[href='AC^ATZ^A10^4200']")) {

alert('Found it!');

}

To use the "contains:" selector like this:

if ($("#cartable-items .cart-trigger[href:contains('ATZ^A10')]")) {

alert('Found it!');

}

Is this possible?

Thanks!

Jason

Jason Eyebe
  • 161
  • 1
  • 2
  • 11

2 Answers2

4

Yes.. use the *= (Attribute contains word selector) - You can read more about the selectors here http://api.jquery.com/category/selectors/

$("#cartable-items .cart-trigger[href*='ATZ^A10']")
wirey00
  • 33,517
  • 7
  • 54
  • 65
1

This approach will also work. Here, the anchor tag has some class with href tag and also has the data-open attribute:

$('.topnav-utility-item-link[href*="/VFLogonFormHopUp"][data-open]')
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77