I'm trying to store values from a database into HTML5 data
attributes.
I can escape them fine because of this answer, but how do I reverse that?
Just reverse the function:
function unescapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, "\"")
.replace(/'/g, "'");
}