Edit, save, self-modifying HTML document; format generated HTML, JavaScript

Your replace function replaces until the /textarea> that is in your clone variable. It doesn’t do it from the first file because there’s a newline character after textarea in the html. One way to fix it would be to add a newline character in the generated html. Like this: var clone = [“<!doctype html><head></head><body><textarea>” + … Read more