-
-
Save kobitoDevelopment/926290d09e3442317f5d39006a0609af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <select id="actionSelect"> | |
| <option value="open">window.openを実行</option> | |
| <option value="copy">クリップボードにコピー</option> | |
| </select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener('DOMContentLoaded', () => { | |
| const select = document.getElementById('actionSelect'); | |
| select.addEventListener('change', (e) => { | |
| if (e.target.value === 'open') { | |
| window.open('https://example.com', '_blank'); | |
| } else if (e.target.value === 'copy') { | |
| navigator.clipboard.writeText('テストテキスト'); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment