jquery replace part of text with html content

131 views Asked by At

How can I replace part of a text with html?

  <span class="squaremeter">3000m2</span>

   var content = $(".squaremeter").text().replace(/\[m2\]/g,'m<sub style="font-size:0.5em;">2</sub>')
   $(".squaremeter").html(content);

The above does not work...

0

There are 0 answers