Answer the question
In order to leave comments, you need to log in
How does load jquery work?
I want to make an application for smart tv. I read that jquery is better not to use. TV resources are small. In the application, I thought to use the load jquery method. Is it possible to do something similar without jquery, in pure javascript?
Answer the question
In order to leave comments, you need to log in
var loadScript = function(src, callback, appendTo) {
var script = document.createElement('script');
if (!appendTo) {
appendTo = document.getElementsByTagName('head')[0];
}
if (script.readyState && !script.onload) {
// IE, Opera
script.onreadystatechange = function() {
if (script.readyState == "loaded" || script.readyState == "complete") {
script.onreadystatechange = null;
callback();
}
}
}
else {
// Rest
script.onload = callback;
}
script.src = src;
appendTo.appendChild(script);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question