3 ms·
This site loads the jQuery library in order to... 1. Access $("#text1")[0].innerHTML 2. $( document ).ready() { typeWriter (); } facepalm
by hashberry 7y ago
This site loads the jQuery library in order to...
1. Access $("#text1")[0].innerHTML
2. $( document ).ready() { typeWriter (); }
facepalm
- whoisjuan 7y agoIt's done like that because the typeWriter effect is actually rendering line break elements (<br>) as it shows up.
- hashberry 7y agowoosh, loading jQuery to access an element is not needed. document.getElementById would suffice.
- whoisjuan 7y agojQuery is still a valid way to manipulate the DOM. There’s nothing wrong with doing that, especially if you already need to load jQuery for something else. I don’t think this is what the comment was referring to.
- hashberry 7y agoThere's no reason to load a 30KB JavaScript library for such a simple webpage. See http://youmightnotneedjquery.com/ http://youmightnotneedjquery.com/