Day 1: What is the DOM & Element Selection
Daily Objective
Section titled “Daily Objective”Understand the DOM tree representation and select elements using modern selectors.
1. Selecting Elements
Section titled “1. Selecting Elements”// Single elementsconst title = document.getElementById('main-title');const firstButton = document.querySelector('.btn-primary');
// Multiple elements (NodeList)const allCards = document.querySelectorAll('.card');allCards.forEach(card => card.classList.add('shadow'));Daily Hands-on Practice (70%)
Section titled “Daily Hands-on Practice (70%)”- Create an HTML page with multiple paragraphs and buttons.
- Select them using
querySelectorandquerySelectorAlland log them to console.