---
# System prepended metadata

title: Dom
tags: [JS]

---

# Dom


###### tags: `JS`

1. querySelector 
> demo:
https://codepen.io/michael-luo/pen/vYKGYyY
2. querySelectorAll 
> demo:
https://codepen.io/michael-luo/pen/gOMrBZJ?editors=1011

3. setAttribute 
> demo:
https://codepen.io/michael-luo/pen/mdEPzZY

4. innerHTML 
> demo:
https://codepen.io/michael-luo/pen/LYZRvJY?editors=1011

5. appendChild 
> demo:
https://codepen.io/michael-luo/pen/wvWzbrE?editors=1010

6. appendChild + for 
> demo:
https://codepen.io/michael-luo/pen/MWejdPW?editors=1010

---

#### 網頁效能評比：innerHTML > appenedChild
#### 但 innerHTML 存在著資安風險，建議確保來源穩定性再去做使用






