jQuery Tips for DotNetNuke Developers


  1. Make sure you call jQuery.noConflict();. This is necessary to not cause other client scripts and libraries to run errors. This is due to the fact that other client scripts might be using the $ designator for a JavaScript class. [jQuery.noConflict(); documentation]

  2. If manually adding jQuery, try to load the jQuery library in the header before all others. Not doing this can lead to the jQuerylibrary not being loaded before another client script or library tries to use it. This is especially true of jQuery plugins.

  3. Always call the jQuery core methods using the jQuery() format. This is related to the previous issue.

  4. Check the jQuery plugin source code. Not all jQuery plugins use the long form of calling jQuery. This can result in errors if you have called jQuery.noConflict();.

  5. In DNN 5+, register jQuery. DNN 5+ allows module developers to register jQuery to be loaded only when modules need it. Just callDotNetNuke.Framework.jQuery.RequestRegistration(). This prevents jQuery from being loaded when it’s not used. If your skin is using widgets, this is not necessary, but should be done for commercial modules regardless.

  6. Use the jQuery hosted option. Look in the Host Settings (DNN 5). This is not necessary, but can reduce page load times, since the site visitor may already have the library loaded in case. However, if the hosted source is having problems hosting the library, your page load times could increase dramatically, as well as not load the library at all. Either way, your client side-code will break.

  7. Only use jQuery Debug Version for debugging. Look in Host Settings (DNN 5). By default, DNN loads the jquery.min.js file. However, when you are debugging jQuery, this makes it nearly impossible to debug. Check this setting to tell DNN to load the uncompressed version of the jQuery library. Only do this on development machines, if possible.

  8. Wrap onload scripts in a ready() function. Wrapping your scripts in the ready() function prevents conflicts with other scripts on the page, including Microsoft scripts, and the DNN Client API.

Comments

Dave said…
Hey Kishan,

can you assist with a DNN blog prob I have?
Is there a way to add the image element to the dnn blog module rss feed so it can be pulled by mailchimp for my weekly rss-to-email newsletter? I use Live Writer to publish to my dnn blog.
tx DAVO
Unknown said…
This right We have often use jQuery in DNN when we have donely use it. Your tips on DNN jQuery for Developer is very good stuff. please give me other information.

Hire Professional and Qualified Dotnet Nuke Developer In India

Popular posts from this blog

SQL Server 2016 TDE ( Transparent Data Encryption)

Setting up Dotnetnuke (DNN) to work with Active Directory

Programming !!!!!!!!!!!