0 votes
in JavaScript by

what is the disadvantage of using innerHTML in JavaScript?

a) Content can not be replaced everywhere

b) We can use like "appending to innerHTML"

c) Even if you use +=like "innerHTML = innerHTML + 'html'" still the old content is replaced by html

d) The entire innerHTML content is not re-parsed and build into elements, therefore its not slower

1 Answer

0 votes
by
Answer:-  C

Reason: If you use innerHTML in JavaScript the disadvantage is

1.Content is replaced everywhere

2.We cannot use like "appending to innerHTML"

3.Even if you use +=like "innerHTML = innerHTML + 'html'" still the old content is replaced by html

4.The entire innerHTML content is re-parsed and build into elements, therefore its much slower

5.The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it.

Related questions

0 votes
asked Jun 9, 2022 in JavaScript by sharadyadav1986
0 votes
asked Oct 10, 2022 in JavaScript by SakshiSharma
...