JavaScript QuerySelectorall ID termina com

console.log(document.querySelectorAll("[id$=foo]"));
Super Sloth