Imagine that we have this HTML structure:
<main>
<div id="one"></div>
<div data-type="John 'phil',15">Light</div>
</main>
I would like to select the element using its data-type
however when I try my code gives me an error:
let aliasScape = alias.replace(/['.*+?^${}()|[\]\\]/g, '\\$&'); //alias is "John 'phil',15"
$("[data-type =| '" + aliasScape + "']")
expression not recognized [data-type =| 'John 'phil',15']
Does anyone know what is wrong? Thanks!