- <script type="text/javascript" data-cfasync="false">
- function download(){
- var text = document.getElementById("my-textarea").value;
- text = text.replace(/\n/g, "\r\n"); // To retain the Line breaks.
- var blob = new Blob([text], { type: "text/plain"});
- var anchor = document.createElement("a");
- anchor.download = "percent.txt";
- anchor.href = window.URL.createObjectURL(blob);
- anchor.target ="_blank";
- anchor.style.display = "none"; // just to be safe!
- document.body.appendChild(anchor);
- anchor.click();
- document.body.removeChild(anchor);
- }
- </script>
-
- <textarea id="my-textarea" style="vertical-align: top; position:relative; display: inline-block; width:15%; min-height:200px; background:none;">
- Notes here...
- </textarea>
- <button type="button" onclick="download()">Save</button>