jack.tang wrote:
Hi John
$ shortcut is convenient and it also make the namespace pollution so
easy.
Here is my reply to Rey
jQuery.noConflict();
// Put all your code in your document ready area
jQuery(document).ready(function($){
// Do jQuery stuff using $ ->[ time 1 ]
$("div").hide();
});
// Use Prototype with $(...), etc.
$('someid').style.display = 'none'; -> [time 2]
// -> [ time 3 ]
@Rey: Conflicts still exist. Here is the case:
1. 1. event "call_me_later_function" is attached to some element at
[time 1], the whole thing may look like:
var call_me_later_function = function(e){$("a.clickme").href
= ...}
$("div#call_me_later").bind("mouseon",
call_me_later_function)
NOTE: I put $ in the later-fire-event.
2. 2. at [time 3], whole page loads completely.
3. 3. then, event "call_me_later_function" is triggered, but you
see, $ has been changed
Bind-early-and-execute-later is nightmare of these $s.
What is the problem with avoiding to use $ in the first place? jQuery
allows that very easily and goes great length to allow that.
I think the bashing here is not justified.
--Klaus