然後先在網頁上初始化。
- new Clipboard('.btn');
接下來只要在 html 上寫 HTML5 data attributes 就可以了。
- <!-- Target -->
- <input id="foo" value="https://github.com/zenorocha/clipboard.js.git">
- <!-- Trigger -->
- <button class="btn" data-clipboard-target="#foo">
- <img src="assets/clippy.svg" alt="Copy to clipboard">
- </button>
0 意見:
張貼留言