Since this is an invite-only community, you cannot join without an invitation. If you would like to request an invitation, please contact the community admin at noreply@forem.com
This community will be migrating to a dedicated subforem in the near future. We are excited to announce a new take on the CodeNewbie Community soon! Email support@forem.com if you have any questions.
`;
// 1. Append the markup to the document
document.body.insertAdjacentHTML('beforeend', modalMarkup);
// 2. Select the elements we just created
const modalRoot = document.getElementById('window-modal');
const closeBtn = modalRoot.querySelector('.crayons-modal__dismiss');
const backdrop = modalRoot.querySelector('.crayons-modal__backdrop');
// 3. Define the remove function
const closeModal = () => {
modalRoot.remove();
};
// 4. Add Event Listeners
// Close when the 'X' button is clicked
if (closeBtn) {
closeBtn.addEventListener('click', closeModal);
}
// Close when the background overlay is clicked
if (backdrop) {
backdrop.addEventListener('click', closeModal);
}
Join the CodeNewbie Community 🌱
CodeNewbie Community 🌱 is a community of 33,255 amazing newbies
Since this is an invite-only community, you cannot join without an invitation. If you would like to request an invitation, please contact the community admin at noreply@forem.com