HOME 未分類 🤖【タップでコピー】のソース 2022年6月29日 <body> <div> <span id="yourCode"> <textarea style="width:100%; height:100px;"> コピーしたい文言を書く </textarea> </span><br> <button id="copyButton">タップでコードを全部コピー</button> </div> </body> <script> var button = document.getElementById('copyButton'); button.addEventListener('click', function(){ var yourCode = document.getElementById('yourCode'); var range = document.createRange(); range.selectNode(yourCode); window.getSelection().addRange(range); document.execCommand('copy'); alert('🤖 コピー シマシタ'); }); </script> </html> タップでコードを全部コピー