Browse Source

added copy button

Fabian Peter Hammerle 5 years ago
parent
commit
acbd6a1502
1 changed files with 12 additions and 1 deletions
  1. 12 1
      index.html

+ 12 - 1
index.html

@@ -6,6 +6,7 @@
 <title>Regex Tester</title>
 
 <script>
+
 function substitute() {
     pattern = document.getElementById('pattern').value;
     text = document.getElementById('text').value;
@@ -18,6 +19,12 @@ function substitute() {
 
     return false;
 }
+
+function copy() {
+    document.getElementById('result').select();
+    document.execCommand('copy');
+}
+
 </script>
 
 <form onsubmit="return substitute()">
@@ -29,6 +36,10 @@ function substitute() {
     <p><input type="submit" value="substitute"></p>
 </form>
 
-<textarea id='result'></textarea>
+<p>
+    <textarea id="result"></textarea>
+    <br>
+    <input type="button" onclick="copy()" value="copy">
+</p>
 
 </html>