jQuery: The Write Less, Do More JavaScript Library

 « Return to Thread: var $varname

Re: var $varname

by Michael Lawson :: Rate this Message:

Reply to Author | View in Thread

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: mjlawson@...

'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.'

Inactive hide details for waseem sabjee ---07/02/2009 02:26:34 PM---its not really a jquery variablewaseem sabjee ---07/02/2009 02:26:34 PM---its not really a jquery variable


From:

waseem sabjee <waseemsabjee@...>

To:

jquery-en@...

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 <dschinkel@...> 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?




 « Return to Thread: var $varname