Q. Why do we need to use an onload event in the script tag after using the async attribute?

  • (A) Invoke code during page loading
  • (B) Invoke code during script loading
  • (C) Invoke code during downloading
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) Invoke code during downloading
Explanation: When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:
Explanation by: Mr. Dubey
When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
185
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate