I watched some jQuery plugins work, and I saw how the next action was closed around the whole plugin.
$(function(){ // plugin code here }); (function($){ // plugin code here })(jQuery);
What is the difference between the two?
The first is the definition of the JQuery DOM Ready function, and the second is the closure of the function, which is performed immediately after its analysis and is performed with the jQueryobject as a parameter.
jQuery
, - , ( )., , , .
- jQuery.ready. , , DOM ( script, , ) — , CSS, .. ..
jQuery.ready
( , DOM ) jQuery $. , $ jQuery, , jQuery.noConflict $ , (, Prototype) jQuery. , , $, , Prototype - , $. .
$
jQuery.noConflict
, :
jQuery(function($) { // Code that uses `$` and expects the DOM to be ready to be // manipulated goes here });
Source: https://habr.com/ru/post/1745954/More articles:Установка символа конца строки для puts - rubyAligning a label and a text field on the same line (left and right) - cssHow to allow netNamedPipeBinding to work with the required UAC? - c #Is there a general database system schema that I can use? - accountingHow to send data to my application via USB connection in Windows - androidPostgreSQL firewall query? - sqlDrupal: warning display - drupalGoogle Calendar DoS API Prevention - google-calendaripad default-landscape not showing - ipadProgrammatically disable WiredHeadset - androidAll Articles