# A better way to implement custom jQuery code?

**URL:** <https://meta.discourse.org/t/a-better-way-to-implement-custom-jquery-code/180056>\
**Category:** Development\
**Created:** [February 17, 2021, 3:18pm UTC](https://meta.discourse.org/t/a-better-way-to-implement-custom-jquery-code/180056 "2021-02-17T15:18:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)\
**Post date:** [February 17, 2021, 3:41pm UTC](https://meta.discourse.org/t/a-better-way-to-implement-custom-jquery-code/180056/2 "2021-02-17T15:41:31Z")

</div>

Discourse is an SPA, a single-page application. This also means the javascripts you add in `<head>` only execute once on the initial page load unless you use the correct methods. You may need to change your code to fire based upon an event handler / listener.

HTH

---

_[View the full topic](https://meta.discourse.org/t/a-better-way-to-implement-custom-jquery-code/180056)._
