Answer the question
In order to leave comments, you need to log in
How to load multiple js files after a condition is met?
About ten or even more js files need to be loaded into the project after the condition is met.
Option via
var script=document.createElement('script');
script.src='http://hostjs-mybb2011.narod.ru/js/alert_tst.js';
document.body.appendChild(script);
Answer the question
In order to leave comments, you need to log in
register(['a.js', 'b.js', 'etc.js']);
function register(urls) {
urls.forEach(function(url) {
var script=document.createElement('script');
script.src = url;
document.body.appendChild(script);
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question