Need help creating an age gate for website in javascript

Hey guys, I tried out a few example codes out there for adding an age gate to my website, but with little success. Using the below code, I was able to get some parts of the age gate to show, but I couldn’t get the the age check function to work, as the options never showed!. :frowning:
Could you guys help me out? Thanks!

Hi @Nick1

Would it be possible to use simple interactions instead of custom code?

Like:

Are you older than 18?

[Button Yes] [Button No]

If someone clicks the YES button, then the overlay/modal disappears. If they click no, they go to disney.com or something.

1 Like

That almost works, but I would really like it to be in JS, so I can make use of cookies.

What if you added custom code to hook to those buttons. something like

$('.btn-yes').on('click', function(){ //do cookie stuff })

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.