|
Forcing the dollar ($) Namespace within your JQuery functions |
Whilst documenting some Open Source platforms for an upcoming project I found that several of the larger more prominent Open Source software solutions perform some subtle tweaks to included JavaScript libraries. In this case JQuery.
This is a short post on ho to ensure that the $ character always represents the JQuery library in your framework.
Drupal and Wordpress have a habit of controlling resource libraries through their own interface layer. This means that within a Drupal framework the $ reference no longer points to the JQuery library as is the default.
You can force this with the no conflict code found here, or alternately you can wrap any of your own functions or plugins with a small piece of code that re-references the dollar ($).
2
3 // Original JavaScript code.
4
5})(jQuery);
Pretty simple, but probably a good thing to do to any JQuery plugins you write.