I think I over-simplified the situation.  I'm writing a widget (which
dynamically generates contents of a "div" element on the page, in this
case) that gets plugged into various parts of the website.  And the
entire website is reliant on jQuery, so the jQuery code and plugins
are already included in every location where the widget gets run.  It
doesn't use PHP or ASP.  But I'll take a look at using your second
suggestion, with noConflict().

I was able to add the Form plugin into my code, and it overrode the
old plugin.  But if another widget is reliant on the original Form
plugin, then it would break their code.  Hence the namespaces.

Any other ideas are still welcome.

-Ben

On Dec 4, 2:19 pm, waseem sabjee <waseemsab...@gmail.com> wrote:
> including it on every page seems troublesome and hard to maintain.
> if you using PHP or ASP you can create your own "Master Page" and include
> there once. and load your other pages in as they are needed.
>
> my suggestion to you in converting to a CMS
> then you can include your script in only one file and all other pages will
> read it.
>
> check this.
> the standard way of using jQuery
>
> 1.
>
> $(function() {
>  var h = $("body');
> h.hide();
>
> });
>
> 2. may be try this way
>
> var $namespace = jQuery.noConflict();
>
> $namespace(function() {
>  var h = $namespace("body"):
>  h.hide();
>
>
>
> });
> On Fri, Dec 4, 2009 at 7:10 PM, ben2233 <ben.duf...@cerner.com> wrote:
> > The website I'm working with has jQuery and the jQuery Form plugin
> > (jquery.form.js) included on every page (it can be used with the
> > syntax "$j").  However, they are using a newer version of jQuery with
> > an older version of the Form plugin... and this causes some errors.
> > So, I would like to include my own version of the Form plugin.  It has
> > been recommended that I put the plugin into a different namespace, but
> > I am not familiar with namespaces in JavaScript.  After researching a
> > little on the internet, it seems like everyone has a different way of
> > implementing namespaces, and I don't know what works with jQuery.
>
> > So, how can I create the plugin in a separate namespace and use it in
> > my code?
>
> > -Ben- Hide quoted text -
>
> - Show quoted text -

Reply via email to