JSFiddle - React, Tailwind, and code Playground
JavaScript
var stringOfHtml = "<p></p><script>alert('fail');</scr" + "ipt><span>script script script</span>";
var wrappedString = '<div>' + stringOfHtml + '</div>';
var noScript = wrappedString.replace(/script/g, "THISISNOTASCRIPTREALLY");
var html = $(noScript);
html.find('THISISNOTASCRIPTREALLY').remove();
alert(html.html().replace(/THISISNOTASCRIPTREALLY/g, 'script'));