What is the disadvantage of using innerhtml in javascript?



What is the disadvantage of using innerhtml in javascript?..

Answer / Deepak Chaudhri

The main disadvantage of using innerHTML in JavaScript is that it can potentially lead to security vulnerabilities, as it allows execution of malicious code if the HTML string contains dangerous script tags (<script>). Additionally, manipulating the DOM directly with innerHTML can be less efficient compared to using more targeted methods like createElement and appendChild.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

How to get checkbox status whether it is checked or not?

1 Answers  


Which software is used for javascript?

1 Answers  


How can a page be forced to load another page in javascript?

1 Answers  


What is push() method in javascript?

1 Answers  


how can we create own web browser?

1 Answers   IBM, Infosys,


what is the difference between window & document in javascript?

1 Answers  


Why javascript is not secure?

1 Answers  


What are the primitive data types in JavaScript?

1 Answers  


What are self invoking functions?

1 Answers  


Why extending array is bad idea?

1 Answers  


write a program to generte a harmonic series 1+1/2+1/3+1/4+1/5 upto 15 terms.

1 Answers  


What are the Advantages and Disadvantages of JavaScript?

1 Answers  


Categories