File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ The [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/A
25
25
26
26
** It is not a programming language but without it JavaScript would not have any knowledge of our web page/HTML document.**
27
27
### Example
28
- ``` HTML
28
+ ``` HTML
29
29
<!DOCTYPE html>
30
30
<html >
31
31
<head >
@@ -37,30 +37,28 @@ The [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/A
37
37
<a href =" https://www.w3schools.com/js/pic_htmltree.gif" >My link</a >
38
38
</body >
39
39
</html >
40
- ```
40
+ ```
41
41
42
- 
42
+ ![ Pictorial Representation of DOM] ( https://www.w3schools.com/js/pic_htmltree.gif )
43
43
### Exercise
44
44
### Essence
45
45
46
46
47
47
## 2. DOM manipulation
48
48
### Explanation
49
49
### Example
50
- 1. Finding DOM elements in HTML page
51
50
51
+ 1 . Finding DOM elements in HTML page
52
52
- ` document.getElementById(id) ` - Find an element by element id
53
53
- ` document.getElementsByTagName(name) ` - Find elements by tag name
54
54
- ` document.getElementsByClassName(name) ` - Find elements by class name
55
55
56
56
2 . Adding and Deleting elements in HTML page
57
-
58
57
- ` document.createElement(element) ` - Create a new HTML element
59
58
- ` document.removeChild(element) ` - Remove an HTML element
60
59
- ` document.appendChild(element) ` - Add an HTML element
61
-
60
+
62
61
3 . Changing existing HTML elements
63
-
64
62
- ` element.innerHTML ` - Change the content/layout of the element
65
63
- ` element.innerText ` - Change just the text of the element
66
64
- ` element.setAttribute(attribute, value) ` - Set/Change attribute of an element
You can’t perform that action at this time.
0 commit comments