Interactive Section - DOM Intro
အောက်ပါ HTML Code ရှိတယ်လို့ သတ်မှတ်ပါ။
<h1 id="main-title">JavaScript Course</h1><p class="content">Paragraph 1</p><p class="content">Paragraph 2</p><button id="click-btn">Click Me</button>Exercise 1: Select by ID
Section titled “Exercise 1: Select by ID”h1 element ကို ID သုံးပြီး ဖမ်းယူတဲ့ Code ရေးပါ။
// Write code to select the element with id "main-title"let title = document.getElementById("main-title");console.log(title);Exercise 2: Using querySelector
Section titled “Exercise 2: Using querySelector”Class name က .content ဖြစ်နေတဲ့ ပထမဆုံး paragraph ကို querySelector သုံးပြီး ဖမ်းပါ။
// Write code here...Challenge: Select All
Section titled “Challenge: Select All”Paragraph ၂ ခုလုံးကို variable တစ်ခုတည်းထဲ ရောက်အောင် ဖမ်းယူပါ။ (List အနေနဲ့ ရောက်ရမယ်)
// Hint: Use querySelectorAll or getElementsByClassName