One of the great things about the DotNetNuke® 5 series is that it automatically includes jQuery. I have noticed that when I use a clean install of DNN 5+, I can immediately use jQuery to my hearts content. However, I was shortly stumped on another DNN website, when I tried to drop some jQuery code onto the page, and I just received script errors.
Since I was using the latest and greatest version of DNN (v5.01.02 at the time), I chalked it up to having a missing reference to jQuery.noConflict(). So, I looked in the rendered HTML to see if it was there. I was surprised to not see jQuery in the HTML source at all. I was highly confused.
I began to backtrack in my mind what I know about the jQuery implementation in DNN. It then dawned on me to look in the Host Settings to see what the jQuery settings were. Maybe, they were somehow changed during my upgrade. Nope. They looked like the default settings to me.
What else uses jQuery in the DNN core though? I mean, the DNN core obviously needs to use jQuery for the Dashboard and its widgets in the default skin. Score! That’s it… The widgets!
I went into the Site Settings for the portal, and enabled widget support for the portal. If you plan to use jQuery on every single page on your DNN site, you may want to do this. Go into the Basic Settings > Appearance section, and check the checkbox for “Enable Skin Widgets.” Doing so will add the jQuery reference to each page. From that point forward, you’ll be able to use jQuery in every Text/HTML module, and everywhere else.
If you’re a module developer running into this, I would still suggest using the following line of code instead: