JS & jQuery

illusio Fri, 10/19/2012 - 11:54

Labdien pieslēdzot ārējos JS & jQuery failus vai ir jāmaina arī to sākums un beigas uz kādu no šiem?

 

 
(function ($) {
// My code
}(jQuery));
 
 
jQuery(document).ready(function($) {
  // My code
})(jQuery);
 
 
(function($) {
Drupal.behaviors.myBehavior = {
  attach: function (context) {
  $(document).ready(function() {
    // My code
    });
  }
};
})(jQuery);

man strādā tikai tad ja kods ir ietverts iekš:

jQuery(document).ready(function($) {
  // My code
})(jQuery);