velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <>
Subject Re: Using jQuery with Velocity
Date Wed, 08 Jul 2009 20:00:58 GMT
If your Velocity template has jQuery javascript (or any other lib that
offers the $ symbol as a shortcut), then i would recommend just not
using the shortcut symbol.  Just use the jQuery variable.  Or if you
really don't want to type six letters, then do:

var J = jQuery;

and use J instead of $. When two syntaxes are close like that, i would
argue that the more maintainable, readable solution is to avoid mixing
them, wherever possible.  But if you really must mix them, then yes,
use the EscapeTool ($esc) or just do:

context.put("D", "$");

and use ${D} instead of ${esc.d}.

But do try to avoid mixing similar syntaxes when an easy alternative
is available.

On Wed, Jul 8, 2009 at 11:50 AM, John Eichelsdorfer<> wrote:
> In attempting to integrate the JQuery UI datepicker tool into our site
> , we are having an issue where the
> jQuery code is being removed due to both projects using the "$" symbol.
> jQuery has this link:
>  that describes how
> to modify the use of jQuery to attempt to get things working, but do you
> have a preferred solution?   Examples would be great if you have them.
> Thank!
> John
> -----
> John Eichelsdorfer
> --
> View this message in context:
> Sent from the Velocity - User mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message