JSFiddle - React, Tailwind, and code Playground

HTML

<label>Remaining evaluations <em>(should be 0)</em>:
    <input type="text" id="count" size="2" value="2" />
</label>

<label>HTML <em>(should be empty)</em>:
    <br />
    <textarea id="html" rows="6"></textarea>
</label>

CSS

label { display: block; margin-bottom: 2em; }
textarea { width: 100%; }

JavaScript

var html = '<scr'+'ipt>$("#count").val(function( i, val ){' +
    'return +val - 1;' +
'});</scr'+'ipt>';

var fragment = document.createDocumentFragment();
fragment.appendChild( $( html )[0] );

$("#html").val(
    $("<div/>")
        .append( html, fragment )
        .html()
);