This project is a fully functional cookie consent modal built with vanilla JavaScript. It was created as part of the "Essential JavaScript" course, focusing on core JavaScript concepts to build a practical and common web feature.
- Dynamic Modal: A pop-up modal that appears on the screen to request user consent for cookies.
- Timed Display: The modal is set to appear after a specific delay using
setTimeout. - Interactive Form: Includes a form for users to submit their preferences.
- Form Data Handling: Utilizes the
FormDataAPI to manage and process form submissions. - User Feedback: Dynamically adds messages to the modal based on user interaction.
- State Management: Elements like buttons can be enabled or disabled based on the state of the form.
- Accessibility: Built with accessibility in mind to ensure it's usable by everyone.
This project demonstrates a solid understanding of fundamental JavaScript concepts, including:
- DOM Manipulation: Creating, positioning, and modifying HTML elements with JavaScript.
- Asynchronous JavaScript: Using
setTimeoutto control when the modal appears. - Event Handling: Managing user interactions like clicks and form submissions, and using
preventDefault()to control default browser behavior. - Forms in JavaScript:
- Handling form submission.
- Using validation attributes.
- Working with the
FormDataAPI.
- Styling with JavaScript: Applying styles directly to elements via the
element.styleproperty. - CSS Classes: Using
classList.toggle()for dynamic styling and state changes.
- Clone the repository.
- Open
index.htmlin your web browser. - The cookie consent modal will appear after a few seconds.
This project was inspired by and completed as part of the "Build a Cookie Consent" module in the "Essential JavaScript" course. A huge shoutout to Scrimba for their amazing interactive learning platform!