Question: I'm trying create a text area in a div with the id of "body". I call the function with an onClick event, but when I click it, all that is created is *object HTMLTextAreaElement*. How can I get this to work?

```
function opentextarea() {
    var input = document.createElement('TEXTAREA');
    input.setAttribute('name', 'post');
    input.setAttribute('maxlength', 5000);
    input.setAttribute('cols', 80);
    input.setAttribute('rows', 40);
    var button = document.createElement('BUTTON');
    document.getElementById("body").innerHTML=input, button;
}

```

Answer: 
You better assign the attributes directly, from what I remember IE got problems with `setAttribute`. The code can be changed to this in order to achieve what you want:

```js
function opentextarea() {
    var input = document.createElement('textarea');
    input.name = 'post';
    input.maxLength = 5000;
    input.cols = 80;
    input.rows = 40;
    input.className = 'myCustomTextarea';
    var button = document.createElement('button');
    var oBody = document.getElementById("body");
    while (oBody.childNodes.length > 0) {
        oBody.removeChild(oBody.childNodes[0]);
    }
    oBody.appendChild(input);
    oBody.appendChild(button);
 }
```

```css
.myCustomTextarea { color: red; font-weight: bold; }
```

```html
<div id="body">hello I will be replaced</div>
<button type="button" onclick="opentextarea();">Open</button>
```

By the way, `textarea` has no `maxlength` to limit characters you have to use JavaScript, for example: [How to impose maxlength on textArea in HTML using JavaScript](https://stackoverflow.com/questions/1125482/how-to-impose-maxlength-on-textarea-in-html-using-javascript)
Try 

```
document.getElementById("body").appendChild(input);
document.getElementById("body").appendChild(button);

```