I can’t link js code from another page on my web
Good for you!
If you want help, please explain the issue in detail. Just stating there is one doesn’t give us anything to go on.
i insert this code in the html file on the same directory as the js file need to link: <script src="Js/addUser.js"></script>
. But can’t link.
If the script is in the same folder, then it might be
<script src="addUser.js"></script>
I’ve also aware of this. Take care that Linux systems are case sensitve, so it can be
<script src="js/addUser.js"></script>
Windows/macOS ain’t case sensitive. Even if this worked on your computer didn’t means it would work here.
I don’t say clearly. that html file is on the same directory that contains the directory containing the js file need to linked. the correct folder name is Js.
Another tip for you. I see this in my console:
It’s better for you to defer loading of the script by adding defer
after the src
attribute’s content of your script (after the quotes that enclose the src
attribute), like so:
<script src="Js/addUser.js" defer></script>
or remove it from the head tag and add it before you close the body tag. Like so, you ensure that the script works when all elements of the page have loaded. For instance, I use the former example in my website to include all the scripts my website needs.
Thank much, it worked
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.