+ 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

18th Nov 2018, 1:51 PM
silentlearner
silentlearner - avatar
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.
30th Nov 2018, 1:59 AM
silentlearner
silentlearner - avatar
+ 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.
18th Nov 2018, 2:35 PM
Vedant Bang
Vedant Bang - avatar
+ 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.
19th Nov 2018, 10:48 PM
silentlearner
silentlearner - avatar
+ 1
That means that there is something wrong with the JavaScript code. Can you post your code on Sololearn?
26th Nov 2018, 4:25 PM
Vedant Bang
Vedant Bang - avatar