'copy' => 'copied!' onClick

This commit is contained in:
Thomas Smith 2022-10-19 12:12:38 -04:00
parent fdd6de57b6
commit 21aace98da
2 changed files with 7 additions and 2 deletions

View file

@ -29,7 +29,7 @@
<input class="one-liner" type="text" value="$ sh <(curl tea.xyz) install&nbsp;{{- .Title -}}" id="myInput" readonly>
<!-- The button used to copy the text -->
<button class="clipboard-copy" onclick="myFunction()" data-bs-toggle="modal" data-bs-target="#exampleModal"><i class="icon-clipboard"></i></button>
<button class="clipboard-copy" id="copy-icon" onclick="myFunction()" data-bs-toggle="modal" data-bs-target="#exampleModal">copy</button>
</div>
<hr>
@ -167,6 +167,8 @@
/* Alert the copied text
alert("Copied " + copyText.value + " to clipboard");*/
document.getElementById("copy-icon").innerHTML = "copied!";
}
</script>

View file

@ -3,7 +3,7 @@
<input class="one-liner" type="text" value="$ sh <(curl tea.xyz) install&nbsp;{{- .Title -}}" id="myInput" readonly>
<!-- The button used to copy the text -->
<button class="clipboard-copy" onclick="myFunction()"><i class="icon-clipboard"></i></button>
<button class="clipboard-copy" onclick="myFunction()" id="copy-icon"><i class="icon-clipboard"></i></button>
</div>
<hr>
@ -66,6 +66,9 @@
// Alert the copied text
alert("Copied " + copyText.value + " to clipboard");
// Copy icon
document.getElementById("copy-icon").innerHTML = "copied!";
}
</script>