# כיצד להוסיף JS לאחר הכותרת?

**URL:** https://meta.discourse.org/t/how-to-add-js-in-after-header/231100
**Category:** Support
**Created:** [25 ביוני,‏ 2022,‏ 7:34pm UTC](https://meta.discourse.org/t/how-to-add-js-in-after-header/231100 "2022-06-25T19:34:54Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [27 ביוני,‏ 2022,‏ 6:09am UTC](https://meta.discourse.org/t/how-to-add-js-in-after-header/231100/4 "2022-06-27T06:09:15Z")

</div>

This is simply not possible. Note, the developers guide mentions you have only three options for script tags to fire:

> [@Developing Discourse Themes & Theme Components](https://meta.discourse.org/t/developing-discourse-themes-theme-components/93648/1):
>
> Now, since this is a script, we need be a little bit more careful where to add to ensure that it fires. You have one of three options:
> 
> ![13](https://global.discourse-cdn.com/meta/original/3X/5/a/5a755d478b693a4520c3da4b13bc7aa6d9b4e9a6.PNG)
> 
> 1. The `</head>` section
> 2. The Header section
> 3. The `</body>` section
> 
> Adding the script to any other section will cause it not to fire.

Is there a particular reason you need the code in the after\_header? There may be other approaches you can take to achieve what you need.

When you tried separating the script in the head and the button in the after\_header, are you sure the script is not firing at all, or is it that you are unable to select the button? It may be due to the way the Ember runloop is.

Perhaps you can try wrapping your script in an

```js
<script type="text/discourse-plugin" version="0.8" >
api.onPageChange(() => {
   var btn = document.querySelector('#Send');

   btn.addEventListener('click', function(e) {
     e.preventDefault();
  
    this.disabled = true;
  
     setTimeout(function(){ btn.disabled=false; }, 10000);
   });

});
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-add-js-in-after-header/231100)._
