JSFiddle - React, Tailwind, and code Playground
by Timmy Willison
HTML
<div id="abc!1">
This is a test
</div>
<div id="jqresult">
</div>
<div id="domresult">
</div>
<div id="domresult2">
</div>
JavaScript
var id = "abc\\!1";
$('#jqresult').html('jQuery matches: <b>' + ($('#' + id).length > 0) + '</b>');
$('#domresult').html('getElementById matches: <b>' + (document.getElementById(id) != null) + '</b>');
$('#domresult2').html('getElementById matches: <b>' + (document.querySelectorAll('#' + id) != null) + '</b>');