You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have some properties avaible for us to work with elements, like:
422
+
-```el.children```
423
+
-```el.firstElementChild```
424
+
-```el.lastElementChild```
425
+
-```el.previousElementSibling```
426
+
-```el.nextElementSibling```
427
+
-```el.parentElement```
428
+
429
+
We also have these properties for nodes:
430
+
-```el.childNodes```
431
+
-```el.firstChild```
432
+
-```el.lastChild```
433
+
-```el.previousSibling```
434
+
-```el.nextSibling```
435
+
-```el.parentNode```
436
+
437
+
> **Note:** the word ```el``` means Element
438
+
439
+
you can remove by using ```remove()```, for example: lets create a paragraph, turn into and element, added to the page and then remove it.
421
440
441
+
```js
442
+
constp=document.createElement('p');
443
+
p.textContent='i will be removed';
444
+
document.body.appendChild(p);
422
445
446
+
p.remove();
447
+
```
423
448
424
-
425
-
426
-
449
+
this will remove the paragraph from the page, but still able in memory, so you can simply added again by using ```appendChild``` or other way to add the element into the page.
0 commit comments