Clarifying Marc's post, after doing jQuery.noConflict(), the jQuery
shop folks can continue to use $ for jQuery stuff if they shadow the
global symbol with a local one. The most common way to do that is to
use a function argument:
jQuery.noConflict();
(function($) {
// Here, $ = jQuery because $ resolves to the argument, so
$("div").css("color", "blue"); // Turns text in all divs blue
})(jQuery);
// Here, $ = Prototype because noConflict() was called, so
$$("div").invoke('setStyle', {color: "green"}); // Turns text in all
divs green
FWIW,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com
On Sep 21, 9:05 am, Marc <[email protected]> wrote:
> It's easy enough for the jQuery shop guys to use this pattern:
>
> (function($) {
> // jQuery stuff here
>
> })(jQuery);
>
> -- Marc
>
> On Sep 20, 8:14 pm, kstubs <[email protected]> wrote:
>
>
>
>
>
>
>
> > I've read through the post, but need clarification on the no-conflict steps.
> > I have written an API using prototype. I am now handing the code over to a
> > jquery shop. They do not want to change their use of $ symbol for jquery.
> > How can this be accomplished?
>
> > Thanks,
> > Karl..
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.