What is the disadvantages using innerHTML in JavaScript?
Submitted by: Administrator► If you use innerHTML the content is replaced everytime.
► We cannot use like 'appending to innerHTML'.
► Even if we use += like "innerHTML = innerHTML + 'html'" then also the old content is replaced by html.
► If we use innerHTML then the entire innerHTML content is re-parsed and build into elements. Therefore it's much slower.
► The innerHTML doesn't provide validation and therefore we can potentially insert invalid and broken HTML in the document and break it.
Submitted by:
► We cannot use like 'appending to innerHTML'.
► Even if we use += like "innerHTML = innerHTML + 'html'" then also the old content is replaced by html.
► If we use innerHTML then the entire innerHTML content is re-parsed and build into elements. Therefore it's much slower.
► The innerHTML doesn't provide validation and therefore we can potentially insert invalid and broken HTML in the document and break it.
Submitted by:
Read Online Expert Developer JavaScript Job Interview Questions And Answers
Top Expert Developer JavaScript Questions
☺ | Mention what is the disadvantage of using innerHTML in JavaScript? |
☺ | Which keyword is used to print the text in the screen? |
☺ | Why it is not advised to use innerHTML in JavaScript? |
☺ | Explain the concept of unobtrusive JavaScript? |
☺ | How are JavaScript and ECMA Script related? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | SWFObject Interview Questions. |