How can i make the 2nd script tag code to be loaded after 3 seconds or after a certain element loads | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i make the 2nd script tag code to be loaded after 3 seconds or after a certain element loads

<head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("div:contains(This Text)").css("display", "none"); }); </script> <script> $(function() { $("#contentPost").delay(1000).fadeIn(500); }); </script> </head> <body> <div id="contentPost">This text.</div> </body>

12th Feb 2019, 10:20 PM
Dev Anand
Dev Anand - avatar
2 Answers
+ 1
look into scheduling calls, we might like to do things at set times set orders thus scheduling a call. some ways javascript does this can be setTimeout allows to run a function once after the interval of time. setInterval allows to run a function regularly with the interval between the runs.
12th Feb 2019, 10:53 PM
peter
peter - avatar
+ 1
пройди до конца курс javascript и ты узнаешь эту тайну
12th Feb 2019, 10:32 PM
_yaroslavv [online_everyday]
_yaroslavv [online_everyday] - avatar