I try to store some JSON data in data-* attributes, but I have encounter one problem: while I generating source code:
<input type="text" data-ia='{"myValue":"One'two'three"}'>
<input type="text" class="input2" data-ia='{"myValue":"OneTwo"three"}'>
and when I trying to get this data
var myData = input.dataset.ia;
var data = JSON.parse(myData);
I've got an error:
SyntaxError: JSON.parse: expected ',' or '}' after
property value in object at line 1 column 20 of the JSON data
And when I looked into the sources the browser shows me:
<input type="text" class="input2" data-ia='{"myValue":"OneTwo"three"}'>
And I have assumed, that it is a problem, but ho to solve it I have no idea. When i tryed to copy this row it's become more confusing as I paste it:
<input type="text" data-ia="{"myValue":"OneTwo"three"}">
My head is ready to blow! Please help me!