+ 3
[Solved] How do you create a typing animation using an external JS file?
There are many codes showing how a typing animation can be created in JavaScript, however, they mostly use internal JavaScript code. I wanted to find out if it's possible to do it with external JavaScript. https://code.sololearn.com/W7Im9s7FBozb/?ref=app
4 ответов
+ 3
Vedant Bang
You are right. I placed onload at the <p> tag when I should've placed it at <body>. I got it to work now. Thanks again.
+ 2
Yes it's possible.
You'll have to link your script first to your HTML page
<script type="text/javascript" link="pathToFile">
After that it is as good as having a script written directly alongside the HTML code.
I'd suggest that you create a custom class in your external file, with all the required functions, then use it in your page by invoking it's functions.
+ 2
When I tried it, it returns "innerHTML is null". It works when I use internal JavaScript.
But thanks for your answer Vedant Bang. Sorry for late reply.
+ 1
That means that there is something wrong with the JavaScript code. Can you post your code on Sololearn?