JSFiddle - React, Tailwind, and code Playground
HTML
<pre id="pre">pre:</pre>
<pre id="post">post:</pre>
JavaScript
var temp = '<div class="persons">';
temp += '<p> <span class="firstname">First Name :</span> <span> [firstname]</span> </p>';
temp += '<p> <span class="lastname">Last Name :</span> <span> [lastname]</span> </p>';
temp += '<p> <span class="tel">Telephone :</span> <span> [tel]</span> </p>';
temp += '</div>';
$("#pre").append(temp);
$("#post").append(temp.replace("[firstname]","foo")
.replace("[lastname]","bar")
.replace("[tel]","1984"));