How to Create an Age Gate Popup [Advanced PRO]

document.getElementById("dateofbirthsubmit").addEventListener('click',function ()
var dateString = document.getElementById('form-field-dateofbirth').value;
if(dateString !=='')
var today = new Date();
var birthDate = new Date(dateString);
var age = today.getFullYear() - birthDate.getFullYear();

if(age < 18 || age > Infinity)
elementorProFrontend.modules.popup.showPopup( {id:50}, event);
alert("You must provide your date of birth!");
} );


Related Topics


Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp
Share on pinterest

Was This Helpful?

Want to share feedback with us?
Thanks for your feedback!

Recommended Videos

Bring a Character to Life in Elementor

Bring a Character to Life in Elementor

Vibrant Gradient Backgrounds

Create Vibrant Gradient Backgrounds

Get Started With Elementor Pro

The Future
of Web Creation. Straight to
Your Inbox.

What interests you?


Awsome content is on the way.

More Resources