Hi there!
I try to use script tags on Customize view like this.
- <div id=“abc”></div>
- <script>alert(“foo”)</script>
but there was no alert…
so script tag doesn’t work on kintone?
Hi there!
I try to use script tags on Customize view like this.
but there was no alert…
so script tag doesn’t work on kintone?
Hello Masa!
The script tag just cannot be used at the Custom View page. Alternatively, you can just write the script part in a js file and upload it at the JavaScript and CSS Customization.
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!
A related issue:
I’m attempting to instantiate Vue.js 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.
Figured this out:
To wait until the DOM is loaded before running the code, without using jQuery, I 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 https://plainjs.com/javascript/events/running-code-when-the-document-is-ready-15/ for more details
Hello Nim
I suggest using “app.record.index.show” in your case.
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.