# Script tag doesn't work on kintone?

**URL:** <https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24>\
**Category:** General\
**Created:** [February 6, 2017, 2:26am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24 "2017-02-06T02:26:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [February 6, 2017, 2:26am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/1 "2017-02-06T02:26:46Z")

</div>

Hi there!

I try to use script tags on Customize view like this.

* * *

1. \<div id=“abc”\>\</div\>
2. \<script\>alert(“foo”)\</script\>

* * *

but there was no alert…

so script tag doesn’t work on kintone?

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [February 7, 2017, 6:19pm UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/2 "2017-02-07T18:19:50Z")

</div>

Hello Masa!

The script tag just&nbsp;cannot be used at the Custom View page.&nbsp;Alternatively, you can just write the script part in a js file and upload it at the JavaScript and CSS Customization.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [February 8, 2017, 8:46am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/3 "2017-02-08T08:46:49Z")

</div>

Hi Yuzo Arai!

\>The script tag just cannot be used at the Custom View page.

umm… OK sure!  
No errors are showing in the Chrome Javascript Console, so I was little confused…

Thank you!

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [December 8, 2017, 4:15am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/4 "2017-12-08T04:15:52Z")

</div>

A related issue:

I’m attempting to&nbsp;instantiate Vue.js&nbsp;in a custom view to add data reactivity.

I need to bind the Vue instance to the id of an HTML element, which creates makes that element Vue’s root component.

However, the HTML in the custom view runs after my Javascript and CSS Customization.

So it seems Vue’s root component (an HTML div that I created in the custom view) doesn’t exist at the time that Vue is run in my Javascript and CSS Customization. Nothing happens.

Any suggestions on how to bind Vue to a root component in a custom view? I tried a \<script\> tag but, as the above commenter mentioned, \<script\> tags don’t work in the custom view page.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [December 8, 2017, 4:32am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/5 "2017-12-08T04:32:48Z")

</div>

Figured this out:

To wait until the DOM is loaded before running the code, without using jQuery, I&nbsp;can use:

```
document.addEventListener("DOMContentLoaded", function(event) { 
  //do work
});

```

(available on 98% of browsers; not IE8 though…although Kintone supports IE11 and onward, so it’s not a problem here)

See&nbsp;[https://plainjs.com/javascript/events/running-code-when-the-document-is-ready-15/](https://plainjs.com/javascript/events/running-code-when-the-document-is-ready-15/) for more details

&nbsp;

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [December 11, 2017, 1:37am UTC](https://forum.kintone.dev/t/script-tag-doesnt-work-on-kintone/24/6 "2017-12-11T01:37:37Z")

</div>

Hello Nim

I suggest using “app.record.index.show” in your case.

[https://developer.kintone.io/hc/en-us/articles/212494758/#OnloadEventDesktop](https://developer.kintone.io/hc/en-us/articles/212494758/#OnloadEventDesktop)

DOM structures may change from time to time in kintone so I would not recommend using it.
