@@ -119,6 +119,7 @@ This is helpful for styling or applying animations.</p>
119119<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
120120<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
121121<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 02. manipulate class ~~~~~~~~~~~~~~~~-->
122+ <p align =" center " >
122123<a href=""
123124 target="_ blank" rel="noopener noreferrer">
124125 <img class="displayed"
@@ -128,6 +129,7 @@ This is helpful for styling or applying animations.</p>
128129 title=""
129130 alt="." />
130131</a ><!-- image002.gif -->
132+ </p >
131133<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
132134<h4 >In this example</h4 >
133135<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
@@ -303,6 +305,7 @@ element.classList.add("className")
303305<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
304306<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
305307<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 03. manipulate class ~~~~~~~~~~~~~~~~-->
308+ <p align =" center " >
306309<a href=""
307310 target="_ blank" rel="noopener noreferrer">
308311 <img class="displayed"
@@ -312,6 +315,7 @@ element.classList.add("className")
312315 title=""
313316 alt="." />
314317</a >
318+ </p >
315319<!-- image003.gif -->
316320<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
317321<h3 >Using <b ><mark >className</mark ></b > Property</h3 >
@@ -365,6 +369,7 @@ add another one to it or else it will append our new class to it.
365369<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
366370<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
367371<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 04. ~~~~~~~~~~~~~~~~-->
372+ <p align =" center " >
368373<a href=""
369374 target="_ blank" rel="noopener noreferrer">
370375 <img class="displayed"
@@ -374,6 +379,7 @@ add another one to it or else it will append our new class to it.
374379 title=""
375380 alt="." />
376381</a >
382+ </p >
377383<!-- image004.gif -->
378384<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
379385<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
@@ -437,6 +443,7 @@ This method selects a single element by its unique ID attribute.
437443<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
438444<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
439445<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 05. ~~~~~~~~~~~~~~~~-->
446+ <p align =" center " >
440447<a href=""
441448 target="_ blank" rel="noopener noreferrer">
442449 <img class="displayed"
@@ -446,6 +453,7 @@ This method selects a single element by its unique ID attribute.
446453 title=""
447454 alt="." />
448455</a >
456+ </p >
449457<!-- image005.png -->
450458<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
451459<h3 >Using <b ><mark >getElementsByClassName</mark ></b ></h3 >
@@ -490,6 +498,7 @@ with the specified class name.</p>
490498<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
491499<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
492500<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 06. ~~~~~~~~~~~~~~~~-->
501+ <p align =" center " >
493502<a href=""
494503 target="_ blank" rel="noopener noreferrer">
495504 <img class="displayed"
@@ -499,6 +508,7 @@ with the specified class name.</p>
499508 title=""
500509 alt="." />
501510</a >
511+ </p >
502512<!-- image006.png -->
503513<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
504514<h3 >Using <b ><mark >getElementsByTagName</mark ></b ></h3 >
@@ -543,6 +553,7 @@ specified tag name.</p>
543553<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
544554<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
545555<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 07. ~~~~~~~~~~~~~~~~-->
556+ <p align =" center " >
546557<a href=""
547558 target="_ blank" rel="noopener noreferrer">
548559 <img class="displayed"
@@ -552,6 +563,7 @@ specified tag name.</p>
552563 title=""
553564 alt="." />
554565</a >
566+ </p >
555567<!-- image007.png -->
556568<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
557569<h3 >Using querySelector</h3 >
@@ -594,6 +606,7 @@ one element.</p>
594606
595607<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
596608<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 08. ~~~~~~~~~~~~~~~~-->
609+ <p align =" center " >
597610<a href=""
598611 target="_ blank" rel="noopener noreferrer">
599612 <img class="displayed"
@@ -603,6 +616,7 @@ one element.</p>
603616 title=""
604617 alt="." />
605618</a >
619+ </p >
606620<!-- image008.png -->
607621<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
608622<h3 >Using querySelectorAll</h3 >
@@ -649,6 +663,7 @@ all elements that match the specified CSS selector.</p>
649663<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
650664<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
651665<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 09. ~~~~~~~~~~~~~~~~-->
666+ <p align =" center " >
652667<a href=""
653668 target="_ blank" rel="noopener noreferrer">
654669 <img class="displayed"
@@ -658,6 +673,7 @@ all elements that match the specified CSS selector.</p>
658673 title=""
659674 alt="." />
660675</a >
676+ </p >
661677<!-- image009.png -->
662678<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
663679<h2 >How to get all ID of the DOM elements with JavaScript?</h2 >
@@ -721,6 +737,7 @@ has an ID. If it has an ID then push it into the array.
721737<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
722738<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
723739<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 10. ~~~~~~~~~~~~~~~~-->
740+ <p align =" center " >
724741<a href=""
725742 target="_ blank" rel="noopener noreferrer">
726743 <img class="displayed"
@@ -730,6 +747,7 @@ has an ID. If it has an ID then push it into the array.
730747 title=""
731748 alt="." />
732749</a >
750+ </p >
733751<!-- image010.gif -->
734752<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
735753<h3 >Approach 2:</h3 >
@@ -789,6 +807,7 @@ has an ID. If it has an ID then push it into the array.
789807<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
790808<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
791809<!-- ~~~~~~~~~~~~~~~~~~~~~~~ 11. ~~~~~~~~~~~~~~~~-->
810+ <p align =" center " >
792811<a href=""
793812 target="_ blank" rel="noopener noreferrer">
794813 <img class="displayed"
@@ -798,6 +817,7 @@ has an ID. If it has an ID then push it into the array.
798817 title=""
799818 alt="." />
800819</a >
820+ </p >
801821<!-- image011.gif -->
802822<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
803823<h2 >JavaScript – How to Get the Data Attributes of an Element?</h2 >
0 commit comments