JSFiddle - React, Tailwind, and code Playground
HTML
<div>Hello World </div>
JavaScript
var text = $('div').text(), i, il= text.length, result = [], char;
for(i=0;i<il;i++) {
char = text.charAt(i);
if(char === " ") {
char = "space";
}
result.push('<img src="' + char + '.png" alt="' + char + '" />');
}
$('div').html(result.join(''));