Last active
October 4, 2024 18:42
-
-
Save pingyen/498dc2512d84166d8c7f0bc6d3c23d13 to your computer and use it in GitHub Desktop.
PTT ask/over18 set cookie in JS
This file contains 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.querySelector('button[name="yes"]').addEventListener('click', e => { | |
e.preventDefault(); | |
document.cookie = 'over18=1; path=/'; | |
location = document.querySelector('input[name="from"]').value; | |
}, false); | |
document.querySelector('button[name="no"]').addEventListener('click', e => { | |
e.preventDefault(); | |
location = '/'; | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment