jQuery: The Write Less, Do More JavaScript Library

Syntax Explanation

View: New views
4 Messages — Rating Filter:   Alert me  

Syntax Explanation

by CoffeeAddict :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


jQuery right now is still like a foreign language to me.  I have
books, etc. but can someone tell me what's going on here:

    // Create shortcut for internal use
    var $jc = $.jcarousel;

    $jc.fn = $jc.prototype = {
        jcarousel: '0.2.3'
    };

what is prototype, and what is jcarousel: '0.2.3', is that just
setting some other variable's value?

Re: Syntax Explanation

by Michael Lawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this notation $.jcarousel means you want to access that field, whether it be to set it to something else, or read the contents.
this notation in javascript  jcarousel: '0.2.3' is setting a key value pair where jcaraousel is the key and 0.2.3 is the value

does that make sense?

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 expresso ---07/02/2009 10:23:58 AM---jQuery right now is still like a foreign language to me. I haveexpresso ---07/02/2009 10:23:58 AM---jQuery right now is still like a foreign language to me. I have


From:

expresso <dschinkel@...>

To:

"jQuery (English)" <jquery-en@...>

Date:

07/02/2009 10:23 AM

Subject:

[jQuery] Syntax Explanation






jQuery right now is still like a foreign language to me.  I have
books, etc. but can someone tell me what's going on here:

   // Create shortcut for internal use
   var $jc = $.jcarousel;

   $jc.fn = $jc.prototype = {
       jcarousel: '0.2.3'
   };

what is prototype, and what is jcarousel: '0.2.3', is that just
setting some other variable's value?





Re: Syntax Explanation

by CoffeeAddict :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks.

so   $jc.fn = $jc.prototype

$jc is just the entire object and .fn is just a variable/field that
was created somewhere else in the code?

On Jul 2, 9:44 am, Michael Lawson <mjlaw...@...> wrote:

> this notation $.jcarousel means you want to access that field, whether it
> be to set it to something else, or read the contents.
> this notation in javascript     jcarousel: '0.2.3'    is setting a key
> value pair where jcaraousel is the key and 0.2.3 is the  value
>
> does that make sense?
>
> cheers
>
> Michael Lawson
> Development Lead, Global Solutions, ibm.com
> Phone:  1-276-206-8393
> E-mail:  mjlaw...@...
>
> '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:       expresso <dschin...@...>                                                                                    
>
>   To:         "jQuery (English)" <jquery-en@...>                                                                    
>
>   Date:       07/02/2009 10:23 AM                                                                                                
>
>   Subject:    [jQuery] Syntax Explanation                                                                                        
>
> jQuery right now is still like a foreign language to me.  I have
> books, etc. but can someone tell me what's going on here:
>
>     // Create shortcut for internal use
>     var $jc = $.jcarousel;
>
>     $jc.fn = $jc.prototype = {
>         jcarousel: '0.2.3'
>     };
>
> what is prototype, and what is jcarousel: '0.2.3', is that just
> setting some other variable's value?
>
>  graycol.gif
> < 1KViewDownload
>
>  ecblank.gif
> < 1KViewDownload

Re: Syntax Explanation

by Michael Lawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thats correct!

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 expresso ---07/02/2009 11:28:00 AM---Thanks.expresso ---07/02/2009 11:28:00 AM---Thanks.


From:

expresso <dschinkel@...>

To:

"jQuery (English)" <jquery-en@...>

Date:

07/02/2009 11:28 AM

Subject:

[jQuery] Re: Syntax Explanation






Thanks.

so   $jc.fn = $jc.prototype

$jc is just the entire object and .fn is just a variable/field that
was created somewhere else in the code?

On Jul 2, 9:44 am, Michael Lawson <mjlaw...@...> wrote:
> this notation $.jcarousel means you want to access that field, whether it
> be to set it to something else, or read the contents.
> this notation in javascript     jcarousel: '0.2.3'    is setting a key
> value pair where jcaraousel is the key and 0.2.3 is the  value
>
> does that make sense?
>
> cheers
>
> Michael Lawson
> Development Lead, Global Solutions, ibm.com
> Phone:  1-276-206-8393
> E-mail:  mjlaw...@...
>
> '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:       expresso <dschin...@...>                                                                                    
>
>   To:         "jQuery (English)" <jquery-en@...>                                                                    
>
>   Date:       07/02/2009 10:23 AM                                                                                                
>
>   Subject:    [jQuery] Syntax Explanation                                                                                        
>
> jQuery right now is still like a foreign language to me.  I have
> books, etc. but can someone tell me what's going on here:
>
>     // Create shortcut for internal use
>     var $jc = $.jcarousel;
>
>     $jc.fn = $jc.prototype = {
>         jcarousel: '0.2.3'
>     };
>
> what is prototype, and what is jcarousel: '0.2.3', is that just
> setting some other variable's value?
>
>  graycol.gif
> < 1KViewDownload
>
>  ecblank.gif
> < 1KViewDownload