Knowledge Walls
John Peter
Pune, Maharashtra, India
Difference between innerHTML and outerHTML in Javascript Element Object with Example
InnerHTML vs outerHTML properties 
innerHTML and outerHTML are properties of element object in javascript. These two things are used to replace the content and selected tag.

innerHTML is set or get content of the selected tag.
outerHTML is set or get content with selected tag.
        <style type="text/css">
            .square_box {
               padding: 20px;
               background-color: lightgreen;
               display: inline-block;
        <script type="text/javascript">
            document.getElementById("a_square_box").innerHTML = "A Plus";
            document.getElementById("b_square_box").outerHTML = "B Plus";
         <div id="a_square_box" class="square_box">A</div>
         <div id="b_square_box" class="square_box">B</div>
Demo & Output 
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details