This uses the query property to detect if the character is a question mark
<a href="https://example.com$[chr]foo" id=x></a>
document.getElementById('x').search.includes('foo') && log($[i])
<a href="https://example.com?foo" id=x></a>