πBuild User Consent Model
// Some code
// javascript
const model = document.getElementById('model');
const showModelBtn = document.getElementById('show-model');
const closeBtn = document.getElementById('modal-close-btn');
const consentForm = document.getElementById('consent-form');
const modalText = document.getElementById('modal-text');
showModelBtn.addEventListener('click', function(){
model.style.display = 'inline'
})
closeBtn.addEventListener('click', function(){
model.style.display = 'none'
})
consentForm.addEventListener('submit', function(e) {
e.preventDefault();
const form = new FormData(consentForm);
const fullName = form.get('fullName');
modalText.innerText = 'We are saving your data .. please wait ..';
setTimeout(() => {
modalText.innerText = 'uploading info..';
}, 1500);
setTimeout(() => {
document.getElementById('model-inner').innerHTML = `
Thanks for sending your info...`;
}, 3000)
})Last updated