Question: How can I implement [prepend](http://api.jquery.com/prepend/) and [append](http://api.jquery.com/append/) with regular JavaScript without using jQuery?

Answer: 
Here's a snippet to get you going:

```
theParent = document.getElementById("theParent");
theKid = document.createElement("div");
theKid.innerHTML = 'Are we there yet?';

// append theKid to the end of theParent
theParent.appendChild(theKid);

// prepend theKid to the beginning of theParent
theParent.insertBefore(theKid, theParent.firstChild);

```

`theParent.firstChild` will give us a reference to the first element within `theParent` and put `theKid` before it.
In order to simplify your life you can extend the `HTMLElement` object. It might not work for older browsers, but definitely makes your life easier:

```
HTMLElement = typeof(HTMLElement) != 'undefined' ? HTMLElement : Element;

HTMLElement.prototype.prepend = function(element) {
    if (this.firstChild) {
        return this.insertBefore(element, this.firstChild);
    } else {
        return this.appendChild(element);
    }
};

```

So next time you can do this:

```
document.getElementById('container').prepend(document.getElementById('block'));
// or
var element = document.getElementById('anotherElement');
document.body.prepend(div);

```