Be the first user to complete this post

  • 0
Add to List

querySelector vs getElementById

Get Element By Id

  • It returns a node list which is live, meaning if you add or remove any element from the DOM the node list will update
  • It is faster relative to the query selector methods

Query Selector

  • It returns a node list which was available at the time of the execution
Watch the following video see an example showing the different between two methods.

Also Read:

  1. nodejs: generate uuid / guid
  2. position:fixed
  3. Getting started with automation testing for webrtc applications
  4. gzip compress and cache api response in express
  5. Error handling in promises interview question
  6. Getting started with es6 iterators and iterables
  7. position:absolute
  8. pseudo elements vs pseudo classes