LoginSignup
1
2

More than 5 years have passed since last update.

ボタン要素のinnerHTMLをクリップボードにコピーする奴

Last updated at Posted at 2018-08-10

HTAで使う奴なのでコピー部分はwindow.clipboardData.setDataで実装。

<button type="button" onclick="tagCopy(this.innerHTML)">hoge</button>
js
function tagCopy(tags){
      window.clipboardData.setData( 'text', tags );
}

これでボタン毎にIDふったりしなくすむぞ(´^ω^`)

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2