<script src="https://s3.pstatp.com/cdn/expire-1-M/vue/2.6.10/vue.min.js"></script>
<div id="id1">
<p>{{apple}}</p>
<p> {{ball}}</p>
<p>{{cat}}</p>
<p> {{dogsss}}</p>
</div>
<script>
var trtr = {
"dogsss": "z",
"ball": "zball"
};
var text = $("#id1").html();
var azs = template_replace(text, trtr);
$("#id1").html(azs);


function template_replace(text, trtr) {
$.each(trtr, function(i, val) {
text = text.replace('{{' + i + '}}', val);
})
return text;
}
</script>