JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http">http</a>
<a href="https">http</a>
<a>no http</a>
<a href="wrong">wrong http</a>
JavaScript
$.expr[':'].attrMatch = function (elem, index, meta) {
//meta[3] contains arguments as a string
var args = meta[3].split(',');
var attr = args[0];
var matches = args.slice(1);
var matched = false;
$.each(matches, function () {
if (!$(elem).is("[" + attr + "]")) {
return false;
}
if ($(elem).attr(attr).match(this)) {
matched = true;
return false;
}
});
return matched;
};
//Should be 2
console.log($("a:attrMatch(href,http,https)").length);