我需要修改以下代码(效果很好):
if ($("#cartable-items .cart-trigger[href='AC^ATZ^A10^4200']")) {
alert('Found it!');
}
要使用“包含:”选择器,如下所示:
if ($("#cartable-items .cart-trigger[href:contains('ATZ^A10')]")) {
alert('Found it!');
}
这可能吗?
谢谢!
杰森
最佳答案
是的..使用*=(属性包含单词选择器)-您可以在此处阅读有关选择器的更多信息http://api.jquery.com/category/selectors/
$("#cartable-items .cart-trigger[href*='ATZ^A10']")
关于JQuery 选择器 : Select element with specific class and 'href' attribute using "contains:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13869970/