Skip to main content

JavaScript Dom

Published 1 min readMarkdown

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 存在著資安風險,建議確保來源穩定性再去做使用

1 view

No comments yet. Be the first to comment.

More from this blog