I have an asp.net UserControl that can be added several times to a page. In this UserControl, I use the jQuery plugin, which I would only like to download once. I use the following code snippet to conditionally load jQuery itself:
if (typeof jQuery == 'undefined') { // load jquery var script = document.createElement('script'); script.type = "text/javascript"; script.src = "/_layouts/SprocketValidator/jQuery.js"; document.getElementsByTagName('head')[0].appendChild(script); } else { //already loaded }
Will there be an equivalent to check if the jQuery plugin is undefined? The plugin I use is a digital buffer input / output plugin .
source share