JSFiddle - React, Tailwind, and code Playground
by Kirouthika K
HTML
//Remove comments from the page
<textarea></textarea><button>remove comments</button>
CSS
textarea{
width:500px;
height:100px;
}
JavaScript
$("button").click(function() {
$("textarea").val($("textarea").val().replace(/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->/g, ""));
$("textarea").val($("textarea").val().replace(/(\/\*)(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*?(\*\/)/g, ""));
$("textarea").val($("textarea").val().replace(/\s\/\/.*/g, ""));
});