I'm trying to add some checkbox to a dynamically-created div and after append the div to a static div. but I'm getting this error:

> 
> TypeError: Cannot read property 'appendChild' of null
> 
> 
> 

I get this error in this line: 

```
document.getElementById(newDiv).appendChild(checkbox));

```

**Code**

```
function func(staticDiv){
   var newDiv = document.createElement("DIV");
   var checkbox = createCheckbox();

   document.getElementById(newDiv).appendChild(checkbox);
   document.getElementById(staticDiv).appendChild(newDiv);

```

}

```
 function createCheckbox() {
     var checkbox = document.createElement("INPUT");
     checkbox.setAttribute("type", "checkbox");
     checkbox.setAttribute("name", "checkbox");
    return checkbox;
 }

```