var a = prompt('title', 1); var elt = [].filter.call(document.querySelectorAll('.id'), el=>el.value == a)[0]; console.log(elt);