Interviewer And Interviewee Guide

Expert Developer JavaScript Interview Question:

Mention what is the disadvantage of using innerHTML in JavaScript?

Submitted by: Administrator
If you use innerHTML in JavaScript the disadvantage is

► Content is replaced everywhere
► We cannot use like "appending to innerHTML"
► Even if you use +=like "innerHTML = innerHTML + 'html'" still the old content is replaced by html
► The entire innerHTML content is re-parsed and build into elements, therefore its much slower
► The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it
Submitted by:

Read Online Expert Developer JavaScript Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.