I understand the shortcut.  But in this example, it appears to just be
a variable here.  So why did they even bother putting a $ in front of
it! ??

On Jul 2, 1:57 pm, James <james.gp....@gmail.com> wrote:
> Yep, as MorningZ said, it's a good practice to use it to differentiate
> those that are storing a jQuery object.
>
> $myDiv = $("#div_1");
> $myDiv.hide();
>
> It's easier to tell that you're working with a jQuery object.
> Otherwise, it's just a regular variable.
>
> On Jul 2, 8:51 am, MorningZ <morni...@gmail.com> wrote:
>
> > "obviously I think 2nd is a jQuery variable?  If that's the case why
> > should I care and where is the docs on that? "
>
> > It just seems to be common practice by a lot of jQuery people smarter
> > than us to signify it's a jQuery object stored in that variable, it
> > has zero to do with jQuery itself per se
>
> > On Jul 2, 2:29 pm, Michael Lawson <mjlaw...@us.ibm.com> wrote:
>
> > > Just to addon to what Waseem here has said:
>
> > > When you are using the default jQuery library, the variable $ is set to 
> > > the
> > > value of jQuery, which creates a shortcut for you so that you don't have 
> > > to
> > > keep typing jQuery everytime you want to access it, you can just type $.
>
> > > cheers
>
> > > Michael Lawson
> > > Development Lead, Global Solutions, ibm.com
> > > Phone:  1-276-206-8393
> > > E-mail:  mjlaw...@us.ibm.com
>
> > > 'Examine my teachings critically, as a gold assayer would test gold. If 
> > > you
> > > find they make sense, conform to your experience, and don't harm yourself
> > > or others, only then should you accept them.'
>
> > >   From:       waseem sabjee <waseemsab...@gmail.com>                      
> > >                                                       
>
> > >   To:         jquery-en@googlegroups.com                                  
> > >                                                       
>
> > >   Date:       07/02/2009 02:26 PM                                         
> > >                                                        
>
> > >   Subject:    [jQuery] Re: var $varname                                   
> > >                                                        
>
> > > its not really a jquery variable
>
> > > in standard js you can say
> > > var $myvar = "hello";
> > > and
> > > var myvar = "hello";
>
> > > both will work the same
>
> > > you can access jquery using either the $ or  JQuery
> > > like
>
> > > $("#myid").hide();
> > > JQuery("#myid").hide();
>
> > > in a line of the JQuery library code you would see something like
>
> > > JQuery = window.JQuery = window.$ ...
>
> > > your could say its like short hand code
>
> > > instead of saying JQuery("") al the time you can just say $("")
>
> > > On Thu, Jul 2, 2009 at 8:18 PM, expresso <dschin...@gmail.com> wrote:
>
> > >   what's the difference between:
>
> > >   var varname
>
> > >   var $varname
>
> > >   obviously I think 2nd is a jQuery variable?  If that's the case why
> > >   should I care and where is the docs on that?
>
> > >  graycol.gif
> > > < 1KViewDownload
>
> > >  ecblank.gif
> > > < 1KViewDownload

Reply via email to