Skip to content

Commit d5c51ff

Browse files
authored
Add: JavaScript DOM
1 parent 68f90da commit d5c51ff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ One place JavaScript!
99
- [Closures](#closures)
1010
- [Splice vs Slice vs Split](#diffs)
1111
- [Data Types](#datatypes)
12+
- [DOM](#dom)
1213

1314
<a name=“callback”/>
1415

@@ -149,3 +150,23 @@ Six primitive data types:
149150
150151
7. Object // This is not primitive data type.
151152

153+
<a name=“dom”/>
154+
155+
#### DOM - Document Object Model
156+
157+
DOM(Document Object Model) is a crucial part for making any Web apps and Mobile apps interactive.
158+
The DOM model represents a document with a logical tree. Each branch of the tree ends in a node, and each node contains objects.
159+
Accessing DOM element, we can change the document structure, style and content.
160+
161+
162+
```HTML
163+
<h2 class="hello"> Hello Github! </h2>
164+
```
165+
166+
```javascript
167+
let h2 = document.getElementsByTagName('h2')[0]; // Since getElementsByTagName returns an array, to access it need to add [0]
168+
console.log(h2.innerText); // Hello Github!
169+
console.log(h2.className); // Hello
170+
```
171+
Such this, there are many other interface listed below in MDN.
172+
[List of DOM Interface](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model#DOM_interfaces)

0 commit comments

Comments
 (0)