JSFiddle - React, Tailwind, and code Playground

JavaScript

var text = "<div><a href=tutu>toto</a></div><a href=rr>AAA</a>";       
    var dom = $('<div>'+text+'</div>');
    dom.find('a').each(function() {
      var el = $(this);
      var html = el.html();
      var span = $('<span/>').html(html);
      el.replaceWith(span);
    });    
    console.log(dom.children());