How to load a script in HTML

2934 views javascript
8

Creating a project using laravel and using TinyMCE to enter text. Created a script to initialize the TinyMCE and it works in my index.html file however to make things more organized I created a js script and stored it

www\MetReport\public\js\tinymce\js, location to my initialize js file.

In my index.html file is stored inside my www folder.

<script type="text/javascript" src="MetReport/public/js/tinymce/js/init-tinymce.js"><script>

this is the code i use to open the script but I do not see my textarea showing up

answered question

So you probably did something wrong, what have you tried to debug it?

can you provide a part of your script ? and your HTML ? If you manipulate your HTML DOM, you need to wait it's fully loaded. with window.onload or $(document).ready if you use jquery.

Protip: HTML5 doesn't require a type attribute. JS is the default.

1 Answer

8

Maybe, try <script type="text/javascript" src="/MetReport/public/js/tinymce/js/init-tinymce.js"><script> , if it doesn't work, just do <script type="text/javascript">//Your code...</script>

posted this

Have an answer?

JD

Please login first before posting an answer.