# Back to top Button

**URL:** <https://discuss.write.as/t/back-to-top-button/85>\
**Category:** Customization\
**Tags:** writeas\
**Created:** [September 14, 2018, 10:51am UTC](https://discuss.write.as/t/back-to-top-button/85 "2018-09-14T10:51:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![matt](https://discuss.write.as/user_avatar/discuss.write.as/matt/32/2760_2.png) [@matt](https://discuss.write.as/u/matt)\
**Post date:** [September 20, 2018, 9:56am UTC](https://discuss.write.as/t/back-to-top-button/85/2 "2018-09-20T09:56:10Z")

</div>

Hey, you can do that today with a bit of Javascript:

```auto
var topP = document.createElement("p");
topP.style.textAlign = "center";
topP.innerHTML = '<a href="#">Back to top</a>';
var cont = document.getElementById("wrapper");
if (cont !== null) {
    // Add to blog index and tag pages
    cont.appendChild(topP);
} else {
    // Add to individual blog post page
    cont = document.getElementById("post-body");
    cont.insertAdjacentHTML("afterend", topP.outerHTML);
}

```

---

_[View the full topic](https://discuss.write.as/t/back-to-top-button/85)._
