One of the site i am using recently implanted suggestion search so currency showing so many unrelated trash.
Trying to hide all div that not contain part of url.
sample url pattern
https://urll.com/lib/search/textquery
div part
<a class="text-secondary group-hover:text-primary" href="https://urll.com/lib/F52dk" alt="F52dk">click here for F52dk link
</a>
Not very familiar with jquery and try to wrote two scripts but none of them worked.
if ($("exampledivname").has(":contains('window.location.pathname.split("/").pop()')").length) {
} else {
hide();
}
var lastpart = window.location.href.substr(window.location.href.lastIndexOf('/') + 1)
var alttt = $('a').attr("alt");
if (lastpart === alttt) {
alert("it's there!!");
}
jsfiddle.net/yd61v753
You can try like below. Explanation is provided in comment.