I am appending element on a node. I am stuck in a situation that on every click event the same element get append to the parent. 

How can I stop preventing the element to append again and again and add just once on the first click.

```js
   document.getElementsByClassName("btn")[0].onclick = function(e) {
   e.preventDefault();
   var div = document.createElement("div");
   div.innerHTML="error";
   document.getElementsByClassName("errors")[0].appendChild(div);
}
```

```css
div { border: 1px solid black }
```

```html
<button class="btn" type="button">Click</button>
<div class="errors">Errors:</div>
```