# Problem with DOM button causing site to reload

**URL:** <https://discourse.processing.org/t/problem-with-dom-button-causing-site-to-reload/3086>\
**Category:** Coding Questions\
**Created:** [August 28, 2018, 10:48pm UTC](https://discourse.processing.org/t/problem-with-dom-button-causing-site-to-reload/3086 "2018-08-28T22:48:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bitstrips](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Bitstrips](https://discourse.processing.org/u/Bitstrips)\
**Post date:** [August 28, 2018, 10:48pm UTC](https://discourse.processing.org/t/problem-with-dom-button-causing-site-to-reload/3086/1 "2018-08-28T22:48:43Z")

</div>

I’m not sure if the button click is the source but when I submit the numbers the result would dissapear nearly instantly and then dissapear because of the site reloading. I want a result to show up at the output class. I

[Codepen Link to full code. (Uses a bit Bootstrap)](https://codepen.io/beboy/pen/rZLKrX)

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [August 29, 2018, 1:21am UTC](https://discourse.processing.org/t/problem-with-dom-button-causing-site-to-reload/3086/2 "2018-08-29T01:21:13Z")

</div>

Looking at your HTML, your “Calculate!” button is of type `submit`

Admittedly, [this stackoverflow thread](https://stackoverflow.com/questions/1878264/how-do-i-make-an-html-button-not-reload-the-page) is nearly a decade old, but their solution is to change it to type `button`

`Edit`:  
Just tried it, it works 🤙 (on mobile…)

---

<div class="post-metadata">

**Author:** ![Bitstrips](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Bitstrips](https://discourse.processing.org/u/Bitstrips)\
**Post date:** [August 29, 2018, 1:37am UTC](https://discourse.processing.org/t/problem-with-dom-button-causing-site-to-reload/3086/3 "2018-08-29T01:37:42Z")

</div>

Of course! 😂 Feel so dumb afterwards. I’m used to handling buttons with PHP, so I used submit 🤦🤦. Thanks for the answer!
