What are NodeLists in JavaScript? 📃

  Рет қаралды 10,921

Bro Code

Bro Code

Күн бұрын

Пікірлер: 12
@BroCodez
@BroCodez Жыл бұрын
// NodeList = Static collection of HTML elements by (id, class, element) // Can be created by using querySelectorAll() // Similar to an array, but no (map, filter, reduce) // NodeList won't update to automatically reflect changes // ---------- CREATE A NODELIST ---------- let buttons = document.querySelectorAll(".myButtons"); // ---------- ADD HTML/CSS PROPERTIES ---------- buttons.forEach(button => { button.style.backgroundColor = "green"; button.textContent += "😁"; }); // ---------- CLICK event listener ---------- buttons.forEach(button => { button.addEventListener("click", event => { event.target.style.backgroundColor = "tomato"; }); }); // ---------- MOUSEOVER + MOUSEOUT event listener ---------- buttons.forEach(button => { button.addEventListener("mouseover", event => { event.target.style.backgroundColor = "hsl(205, 100%, 40%)"; }); }); buttons.forEach(button => { button.addEventListener("mouseout", event => { event.target.style.backgroundColor = "hsl(205, 100%, 60%)"; }); }); // ---------- ADD AN ELEMENT ---------- const newButton = document.createElement("button"); //STEP 1 newButton.textContent = "Button 5"; //STEP 2 newButton.classList = "myButtons"; document.body.appendChild(newButton); //STEP 3 buttons = document.querySelectorAll(".myButtons"); // ---------- REMOVE AN ELEMENT ---------- buttons.forEach(button => { button.addEventListener("click", event => { event.target.remove(); buttons = document.querySelectorAll(".myButtons"); }); });
@anushkasingh9470
@anushkasingh9470 7 ай бұрын
So lucky to find your channel, been watching your videos since past 2-3 weeks. Bro you really made JS easy for me, a true and catchy thumbnail. THANKSSS! Keep uploading!😃
@sepiweb
@sepiweb Жыл бұрын
It was very useful❤️
@sebastienrteller
@sebastienrteller Жыл бұрын
Hey! My latest hyperfixation has been learning coding in react and I've been binging your videos for about 2 weeks now. I don't know if you've done anything about dependent dropdowns so far, but it has been driving me insane trying to figure it out. My personal use is a little more complicated with tons of dependencies, but I was wondering if you'll ever do a solid dropdowns and dependent dropdowns video in the future. Keep up the awesome work! Your videos are perfect for my brain to get it
@mabblers
@mabblers Жыл бұрын
Great lesson. Is there a js obj that can take on new value and save them without a db?
@shadow-k3k1g
@shadow-k3k1g Жыл бұрын
good job
@acque-azzure
@acque-azzure Жыл бұрын
The craziest thing is that i was just using this in an Project of mine
@Abhishek_Fitness_work
@Abhishek_Fitness_work Жыл бұрын
Hello bro I am from🇮🇳 India
@BroCodez
@BroCodez Жыл бұрын
Hello from the USA
@kvo6307
@kvo6307 Жыл бұрын
Hey bro are you gonna upload the full course so I can watch in order?
@BroCodez
@BroCodez Жыл бұрын
yes
@khushansharora3383
@khushansharora3383 6 ай бұрын
9:00
Learn the JavaScript classList property easy! 💡
16:00
Bro Code
Рет қаралды 12 М.
What are JavaScript PROMISES? 🤞
12:37
Bro Code
Рет қаралды 84 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
Learn JavaScript KEY EVENTS in 10+ minutes! ⌨
11:16
Bro Code
Рет қаралды 29 М.
Learn DOM Navigation in 15 minutes! 🧭
15:27
Bro Code
Рет қаралды 17 М.
Learn JavaScript ELEMENT SELECTORS easy! 📑
17:38
Bro Code
Рет қаралды 31 М.
Learn JSON files in 10 minutes! 📄
10:09
Bro Code
Рет қаралды 67 М.
JavaScript GETTERS & SETTERS are awesome!!! 📐
13:14
Bro Code
Рет қаралды 20 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 28 М.
Learn how JavaScript COOKIES work! 🍪
14:15
Bro Code
Рет қаралды 59 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН