JSFiddle - React, Tailwind, and code Playground

HTML

<input id=testfoo>

JavaScript

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