How to insert and show html code in jQuery Terminal?

I want to use this code but changing the textArea to a divor any other jQuery terminal situable object to show it in term.echo().

I’m doing that by changing html line 1 for <div id="txtA"></div>

and line 7 of javascript for document.getElementById('txtA').innerHTML = diff;

Can I show html in the jQuery Console?

Something like term.echo('<span id="txtA"></span>') ?? I’m getting the code like if I were using <pre></pre>

Thanks.

Answer

Use this code, raw will output raw html into terminal and finalize will be called when node is added so you can modify it, finalize will also be called when terminal is resized.

term.echo('<span id="txtA"></span>', {
  raw: true,
  finalize: function(div) {
    document.getElementById('txtA').innerHTML = diff;
    // or using jQuery
    div.find('#txtA').html(diff);
  }
});