Add HTML tag to non HTML tag
HTML
<div id="element">
Hello, My name is Sharad
<p>I work in WP</p>
<p>I Love WP</p>
AWESOME
</div>
JavaScript
const tags = ["span", "strong"];
var increment = 0;
$('#element').contents().filter(function(index, value){
if(this.nodeType == 3 && $.trim(this.nodeValue).length){
$(this).wrap('<'+tags[increment]+' class="custom-class-'+index+'" />');
increment++;
}
});