Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  9] [ 2]  / answers: 1 / hits: 155170  / 15 Years ago, tue, december 1, 2009, 12:00:00

Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded.



something like



if(!jQuery) {
//load jquery file
}

More From » jquery

 Answers
16

Maybe something like this:



<script>
if(!window.jQuery)
{
var script = document.createElement('script');
script.type = text/javascript;
script.src = path/to/jQuery;
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>

[#98183] Thursday, November 26, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
karivictoriab

Total Points: 530
Total Questions: 90
Total Answers: 95

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
;