+ 4
Typing Effect
The code works except one small problem, whenevr i use text like Lorem Ipsum and i copy and paste that into my code it does something strange, it doesnt fully type the text. Any clues on how to fix this? https://code.sololearn.com/WoSTUTdpj0Ob/?ref=app
21 Réponses
+ 2
Did you type in a text longer than 100 characters? There's a maximum of input characters, at least in sololearn...
+ 1
onload just makes sure that the js is executed when the html is loaded
+ 1
use window.onload when you are using Sololearn's javascript tab. It makes sure that the html is loaded first, so it can find the DOM elements.
0
It's trying to get the html element before it is loaded.
Put all the js inside of
window.onload = function() {
// your js
}
0
Its still not working
0
I entered "Hello world" and ut was typed
0
No but if u typed in the Loreum Ipsum the thing kindof just breaks
0
I just tried with 99 charcters and its still doing it, it could do with the amount of lines or something
0
Maybe newline characters? You could try to remove them from the string before the animation starts
0
Okay, heres a better example, when you put into the prompt box and say “This is my demo” it will not make the demo come out, try it and youll see
0
Why did you remove window.onload? Now I get the same type error as in the beginning
0
Ye, sorry forgot to save but it still dont work
0
Seems to work for me?
Which error message exactly do you get?
0
It didnt give me an error message it just stops the whole thing, did you type what i said? Lisa
0
What do you mean "it stops"?
The text gets typed, then it stays on screen.
0
Ok, ye its workinng fine i was using mobile but i just tried it in pc and its working fine
0
So each time i have an element i have to use window.onload?
0
hi mom when did u start programming
0
Java script project 1/6 already finished, but project two not active and i didn't gain java script certficate.
0
Your Mom
Sololearn seems to have a limit on the length of the input in the prompt...
maybe use a text input element instead?
something like this:
https://code.sololearn.com/WZPr0l9yHZaF/?ref=app