I have
<div class="test">hello everyone</div>
and I want to change each hello in this div with
<h1>helllo</h1>
for example I've used
$(this).text().replace("hello", "<h1>hello<h1>");
but it outputs
<h1>hello</h1>
I want it apply as HTML not as text how can I do it?
$(this).html($(this).html().replace("hello", "<h1>hello</h1>"));$(".code").html($(".code").html().replace("int", "<span class='var'>int</span>"));... what you wrote should be this (without any wrapping function).