【发布时间】:2019-08-23 03:59:01
【问题描述】:
我的网站上有一些包含 STRING 的链接的 js,它看起来像这样:
if($("a[href*='STRING']").length > 0){
console.log("yes");
}
如果有这样的链接,则返回true:
<a href="STRING.html">text</a>
问题是它也通过这样的链接返回 true:
<a href="index.html?search=STRING">text</a>
如何限制 jquery 选择器只查看 href 的第一部分?
【问题讨论】: