Cannot Use Query Selector With Id's That Includes "."
Assume that I have a I want to select this li. To be able to achieve it, I wrote, var id='gen__1002_____46.14_li'; document.querySelector('#
Solution 1:
You need to escape the dot
$('#thisIs\\.anId') // will select <span id="thisIs.anId">test</span>
And in pure js:
var id="gen__1002_____46.14_li";
id = id.replace(/\./g, '\\\\.'); // escaping dots using regex
document.querySelector("#" + id);
EDIT
If you just want to select element by id, use getElementById()
document.getElementById(id);
Post a Comment for "Cannot Use Query Selector With Id's That Includes ".""