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
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']")
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]')
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.