import { Controller } from 'stimulus' export default class extends Controller { static targets = ['source', 'input', 'button'] copy() { this.inputTarget.value = this.sourceTarget.innerText this.inputTarget.select() document.execCommand('copy') this.buttonTarget.innerHTML = '' setTimeout(function () { document.getElementById('copied').innerHTML = '' }, 1500) } }