I want to construct an HTML string before I append it to an element. Here is the string:
var html = '<tr><td data-value="' + someValue + '"></td></tr>';
$(el).append(html);
The value in someValue is 24". There is a " in it.
When the HTML is appended the element is wrong. Apparently appending "24"" makes the element recognize only the "24" and there is one loose " in the end. How can I do this?
I tried to replace:
(someValue.indexOf('"') > 0 ? someValue.replace('"','\"') : someValue)
But still the error persists.