Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

  • 4/7/2015
  • 28746 Views

Comments

28746 Views

jQuery

Last updated 9 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery can be used in all versions of DotNetNuke, but native support was added for it in 5.0

With jQuery we have tried to provide a mechanism that only loads the jQuery library when absolutely necessary. If none of the modules or skin-objects on a page require jQuery, then it won’t be included in the page. If your module wants to use jQuery then you should use the relevant API method to ensure that it only loads once, otherwise issues may occur (such as scripts not working):

The initial API that was added in DNN 5.0 has now been deprecated (i.e. the method is marked as obsolete), but is still commonly used, particularly for skins/modules which target versions of DNN prior to 7.1.0. It looks like this:

DotNetNuke.Framework.jQuery.RequestRegistration()

If you are targeting DNN 7.2.0 or above, the new API method looks like this - you can read more about JavaScript Libraries here:

JavaScript.RequestRegistration(CommonJs.jQuery);


DotNetNuke Core Framework 4.x

Please note that DNN 6.1.0 removed the internal usage of the flag "jquery_registered". Although this was a common workaround, it was technically peeking around the public API, which is inherently an unsafe act. The more robust alternative is to use a method such as Bruce Chapmon has on his blog, which shows how to use jQuery and jQuery UI safely within DotNetNuke 4 5 and 6.

Other tips about jQuery usage in DotNetNuke can be read here


jQuery UI

If you are looking for information related to DotNetNuke jQuery-UI specific plugins, please see Reusable-DotNetNuke-jQuery-Plugins.

As of DotNetNuke 6, jQuery-UI is also shipped (and integrated) with the core. When registering jQuery-UI, there is no need to register jQuery as the jQuery-UI registration method will handle this for you. You can register jQuery-UI for use in your own work by using the following code (in Page Load or Init):

DotNetNuke.Framework.jQuery.RequestUIRegistration()

Other options

Skin Objects for including jQuery, Javascript and CSS Stylesheets in DotNetNuke Skins

Skin Object

A jQuery skin object was initially included with 6.0, however, as of 6.2 the following options are available.

For direct usage in .ascx skins:
<%@ Register TagPrefix="dnn" TagName="JQUERY" Src="~/Admin/Skins/jQuery.ascx" %>

<dnn:JQUERY ID="dnnjQuery" runat="server" />

HTML skin designers can use the JQUERY token:
[JQUERY]

The following properties for the skin object can be set to True/False (False by default):
  • DnnjQueryPlugins - If true, the dnn plugins used for panels and tabs will be loaded in addition to jQuery and jQueryUI.
  • jQueryHoverIntent - If true, the HoverIntent script used for tooltips will be loaded in addition to jQuery.
  • jQueryUI - If true, jQueryUI will be loaded in addition to jQuery.
Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out