Skip to content

Commit cbcba99

Browse files
committed
dom manipulation
1 parent fb2e2e3 commit cbcba99

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Courses/IBM-JavaScript-Essentials/08-DOM-Manipulation/clas-list.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@
2626

2727
<script>
2828
function performClassListOperations() {
29+
// Getting the Paragraph Element
2930
const paragraph = document.getElementById("myParagraph");
3031

31-
// Adding a class
32+
// Adds the class "italic" to the paragraph element's class list.
3233
paragraph.classList.add("italic");
3334

34-
// Removing a class
35+
// Removes the class "highlight" from the paragraph element's class list.
3536
paragraph.classList.remove("highlight");
3637

37-
// Toggling a class
38+
// Toggles the class "underline" on the paragraph element. In this case, it explicitly adds the class "underline" because the second parameter is true.
3839
paragraph.classList.toggle("underline", true);
3940

4041
// Checking if a class exists

0 commit comments

Comments
 (0)