<div class="info" data-id="1">
Info 1
</div>
<div class="info" data-id="2">
Info 2
</div>
<div>${1}</div>
<div>${1}</div>
<span>${1}</span>
<div>${2}</div>
(function(window, document) {
'use strict';
function replaceData(data, id) {
var bodyData = body.innerHTML,
pattern = new RegExp('\\$\\{' + id + '\\}', 'g');
if(pattern.test(bodyData)) {
body.innerHTML = bodyData.replace(pattern, data);
}
};
var body = document.body,
elements = document.getElementsByClassName('info'), i;
for(i = 0; i < elements.length; i++) {
replaceData(elements[i].innerHTML, elements[i].dataset.id)
}
})(window, document);