I found this function here:
function contains(selector, text) {
var elements = document.querySelectorAll(selector);
return Array.prototype.filter.call(elements, function(element){
return RegExp(text).test(element.textContent);
});
}
I got it from this link, it works fine to find the first div element but I don't know how I can make it return all the divs in an array?
Thank you