JSFiddle - React, Tailwind, and code Playground

HTML

<script id="foo" type="application/json" id="foo">
alert('coucou')</script>

JavaScript

$( function(){

$t= $('#foo').clone().attr('type', 'text/javascript'); 
$('body').append( $($t) )
console.log( $t.text())

$s= $('#foo').detach().attr('type', 'text/javascript'); 
$('body').append( $s )
console.log( $s.text())

$p=$('<script>').attr('type',"text/javascript").text('alert("hello!")');
$('body').append( $p )

})