Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// dari
// masukan html ini
// <input type="hidden" id="idcopy" :value="copyval">
// <button class="absolute cursor-pointer" style="right:10px;top:100px;" @click="copyvalue()">tes</button>
copyValue () {
let testingCodeToCopy = document.querySelector('#idcopy')
testingCodeToCopy.setAttribute('type', 'text')
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
alert('Testing code was copied ' + msg);
} catch (err) {
alert('Oops, unable to copy');
/* unselect the range */
testingCodeToCopy.setAttribute('type', 'hidden')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.