Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- calling & defining functions using funcName() vs. window['funcName']()


Fotiman - 10:22 pm on Jan 7, 2013 (gmt 0)



is this still the correct ready() syntax to use without noConflict():

jQuery(document).ready(function($) {...});

That should still work, though you could omit the $ in the parameter list and write it as:
jQuery(document).ready(function() {...});
or alternatively:
$(document).ready(function() {...});


how does the script now know that $ = jQuery w/o that statement in there?

The jQuery library creates the global $ variable. When it does that, it stores a reference to whatever the global variable $ was assigned to previously (if anything), and that's how it resets it when you call noConflict.


in the js block, and with jQuery library loaded, I get an alert with the following:

function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
}

That is correct. Note, that is the non-minified version of the code. When minified, you'll see this:

function(a,b){return new e.fn.init(a,b,h)}

Which is functionally identical, but with spaces/comments removed and shortened variable names.


Thread source:: http://www.webmasterworld.com/javascript/4533285.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com