# How do i insert Javascript into a Topic?

**URL:** https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429
**Category:** Support
**Created:** [May 18, 2016, 8:48am UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429 "2016-05-18T08:48:17Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![broz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/broz/32/61170_2.png) [@broz](https://meta.discourse.org/u/broz)
#### Post date: [May 18, 2016, 8:48am UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/1 "2016-05-18T08:48:17Z")

</div>

For example i would like to insert a optinmonster Optin. This should be the code:

```html
<!-- This site is converting visitors into subscribers and customers with OptinMonster - http://optinmonster.com -->
<div id="om-o1ozq0it5dg9dp9v-holder"></div>
<script>
var o1ozq0it5dg9dp9v,o1ozq0it5dg9dp9v_poll=function(){var r=0;return function(n,l){clearInterval(r),r=setInterval(n,l)}}();!function(e,t,n){if(e.getElementById(n)){o1ozq0it5dg9dp9v_poll(function(){if(window['om_loaded']){if(!o1ozq0it5dg9dp9v){o1ozq0it5dg9dp9v=new OptinMonsterApp();return o1ozq0it5dg9dp9v.init({u:"17705.331160",staging:0,dev:0,beta:0});}}},25);return;}var d=false,o=e.createElement(t);o.id=n,o.src="//a.optnmnstr.com/app/js/api.min.js",o.onload=o.onreadystatechange=function(){if(!d){if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){try{d=om_loaded=true;o1ozq0it5dg9dp9v=new OptinMonsterApp();o1ozq0it5dg9dp9v.init({u:"17705.331160",staging:0,dev:0,beta:0});o.onload=o.onreadystatechange=null;}catch(t){}}}};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(o)}(document,"script","omapi-script");
</script>
<!-- / OptinMonster -->

```

If i paste it into a topic it won’t show. Is there a way to make it work natively?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 18, 2016, 8:53am UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/2 "2016-05-18T08:53:25Z")

</div>

You can only insert JS via Admin, Customize in the header or footer.

---

<div class="post-metadata">

### Author: ![broz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/broz/32/61170_2.png) [@broz](https://meta.discourse.org/u/broz)
#### Post date: [May 18, 2016, 9:03am UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/3 "2016-05-18T09:03:30Z")

</div>

First off let me thank you for the quick answer. Is there a plugin (i’ve searched but didn’t find anything) to let me put js in a topic? Or should i make a plugin by miself?

---

<div class="post-metadata">

### Author: ![McBlu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcblu/32/91128_2.png) [@McBlu](https://meta.discourse.org/u/McBlu)
#### Post date: [March 24, 2018, 9:55pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/4 "2018-03-24T21:55:14Z")

</div>

I would like to do this too. It would permit posting material in particular categories in some sort of logical place you’d expect to find it and not be limited to the header and footer (assuming you aren’t proficient in code).

---

<div class="post-metadata">

### Author: ![christian\_01](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christian_01/32/162392_2.png) [@christian\_01](https://meta.discourse.org/u/christian_01)
#### Post date: [November 21, 2019, 3:20pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/5 "2019-11-21T15:20:43Z")

</div>

I need to do this too!

---

<div class="post-metadata">

### Author: ![ElForoViajero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elforoviajero/32/187116_2.png) [@ElForoViajero](https://meta.discourse.org/u/ElForoViajero)
#### Post date: [April 23, 2020, 2:11pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/8 "2020-04-23T14:11:32Z")

</div>

It’s possible to insert a JS code in a Category page or into a Topic?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 23, 2020, 2:14pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/9 "2020-04-23T14:14:41Z")

</div>

You add JS to a theme, and on the JS code you can target specific categories or topics using DOM selectors.

---

<div class="post-metadata">

### Author: ![ElForoViajero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elforoviajero/32/187116_2.png) [@ElForoViajero](https://meta.discourse.org/u/ElForoViajero)
#### Post date: [April 23, 2020, 2:16pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/10 "2020-04-23T14:16:20Z")

</div>

> [@Falco](#):
>
> DOM

Thanks for your quick reply. I will look into DOM as I have no idea how it works at the moment.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:37pm UTC](https://meta.discourse.org/t/how-do-i-insert-javascript-into-a-topic/44429/11 "2024-06-08T12:37:02Z")

</div>

This topic was automatically closed after 2943 days. New replies are no longer allowed.
