I am trying to create nested divs in javascript, but it is not woking. Below is the code which I tried.I am applying xternal css them

```
<!DOCTYPE html>
 <html>
   <!--<meta charset="UTF-8">-->
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>first2</title>
  <head>
   <link rel="stylesheet" type="text/css" href="jsoncss.css">
 </head>
   <script type="text/javascript"             src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <script>

     /*html=$("<div class='wrapper'>").append(
         $("<div class='LeftSection'>").append(
              $("<div class='MyMainSavings'>")).append(
                               $("<div class='MyMainSavingsTop'>")));*/

      /*$("<div>", {class: "wrapper"}).append(
    $("<div>", {class: "LeftSection"}).append(
        $("<div>", {class: "MyMainSavings"}).append(
            ("<div>", {class: "MyMainSavingsTop"}),
            ("<div>", {class: "MyMainSavingsBottom"})
        ),
        $("<div>", {class: "MyMainSavings"}).append(
            ("<div>", {class: "MyMainSavingsTop"}),
            ("<div>", {class: "MyMainSavingsBottom"})
        ),
        $("<div>", {class: "MyMainSavings"}).append(
            ("<div>", {class: "MyMainSavingsTop"}),
            ("<div>", {class: "MyMainSavingsBottom"})
        ),
        $("<div>", {class: "MyMainSavings"}).append(
            ("<div>", {class: "MyMainSavingsTop"}),
            ("<div>", {class: "MyMainSavingsBottom"})
        )
    ), 
    $("<div>", {class: "RighSection"}).append(
        $("<span>").text(
            "Some text"
        )
    )
     ).appendTo("body")*/

  var iDiv = document.createElement('div');

    //iDiv.id = 'wrapper';
    iDiv.className = 'wrapper';
     //document.getElementsByTagName('body')[0].appendChild(iDiv);

      var div2 = document.createElement('div');
          div2.className = 'LeftSection';
     iDiv.appendChild(div2);    

     /*$(document).ready(function () {
         $(".wrapper").addClass("wrapper");
         });*/
      </script>
     <body> 
     </body>
      </html>

```

How to link external css to divs created in javascript?I tried addClass but it dosnt work.
Please consider commented out code also, those are different ideas that i tried.