[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-04 Thread Casey Wise

I work much better with examples, I hope this helps.

The first set of parenthesis is the selector, consider this hidden
field:

input type=hidden id=thisHidden value=12.21

If you'd like to fetch the 12.21 out of this hidden field, think of
a CSS selector (where ID = # and CLASS = .):

var thisVal = $(#thisHidden).val();

then if you do an 'alert' on this val:

alert(thisVal);

12.21 would be alerted.

jQuery rocks, have fun and keep after it, you'll be glad you did.

On May 3, 1:39 am, kiusau kiu...@mac.com wrote:
 QUESTION:  What does the first pair of parentheses indicate in the
 following statement:

         $().getBrowserInformation();

 BACKGROUND:  I have noticed that their presence or absence can make or
 break JavaScript's acknowledgement of a method's existence on the one
 hand, but seem entirely unnecessary under other circumstances.

 Roddy


[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Sam Sherlock
$ == jQuery

to make jQuery work when other js frameworks are also in use you can make
jQuery() work too - avoiding conflicts

the first set of parenthis are for passing params to the jquery object

AFAIK When setting defaults for jquery plugins the parenthis are not
required.  I don't know if they are optional here or not - plugin defaults
are variables used by plugins, which extend the jquery object (props 
methods)

- S


2009/5/3 kiusau kiu...@mac.com

 .getBrowserInformation


[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Klaus Hartl

$() === $(document)

--Klaus


On 3 Mai, 07:39, kiusau kiu...@mac.com wrote:
 QUESTION:  What does the first pair of parentheses indicate in the
 following statement:

         $().getBrowserInformation();

 BACKGROUND:  I have noticed that their presence or absence can make or
 break JavaScript's acknowledgement of a method's existence on the one
 hand, but seem entirely unnecessary under other circumstances.

 Roddy


[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Ariel Flesler

FYI, not anymore.

$() === $([])

It now returns an empty jQuery collection

--
Ariel Flesler

On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote:
 $() === $(document)

 --Klaus

 On 3 Mai, 07:39, kiusau kiu...@mac.com wrote:

  QUESTION:  What does the first pair of parentheses indicate in the
  following statement:

          $().getBrowserInformation();

  BACKGROUND:  I have noticed that their presence or absence can make or
  break JavaScript's acknowledgement of a method's existence on the one
  hand, but seem entirely unnecessary under other circumstances.

  Roddy




[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Ariel Flesler

Correction:

$() === $(document)
$(null) === $([])
$() === $([])

This is wrongly documented and has orphaned code, will report.

--
Ariel Flesler

On May 3, 12:16 pm, Ariel Flesler afles...@gmail.com wrote:
 FYI, not anymore.

 $() === $([])

 It now returns an empty jQuery collection

 --
 Ariel Flesler

 On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  $() === $(document)

  --Klaus

  On 3 Mai, 07:39, kiusau kiu...@mac.com wrote:

   QUESTION:  What does the first pair of parentheses indicate in the
   following statement:

           $().getBrowserInformation();

   BACKGROUND:  I have noticed that their presence or absence can make or
   break JavaScript's acknowledgement of a method's existence on the one
   hand, but seem entirely unnecessary under other circumstances.

   Roddy




[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Ariel Flesler

Fixed: http://dev.jquery.com/changeset/6334

$() === $(document)
$(undefined) === $([])
$(null) === $([])
$() === $([])

--
Ariel Flesler

On May 3, 12:28 pm, Ariel Flesler afles...@gmail.com wrote:
 Correction:

 $() === $(document)
 $(null) === $([])
 $() === $([])

 This is wrongly documented and has orphaned code, will report.

 --
 Ariel Flesler

 On May 3, 12:16 pm, Ariel Flesler afles...@gmail.com wrote:

  FYI, not anymore.

  $() === $([])

  It now returns an empty jQuery collection

  --
  Ariel Flesler

  On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

   $() === $(document)

   --Klaus

   On 3 Mai, 07:39, kiusau kiu...@mac.com wrote:

QUESTION:  What does the first pair of parentheses indicate in the
following statement:

        $().getBrowserInformation();

BACKGROUND:  I have noticed that their presence or absence can make or
break JavaScript's acknowledgement of a method's existence on the one
hand, but seem entirely unnecessary under other circumstances.

Roddy




[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread kiusau

On May 3, 1:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote:
 $() === $(document)

So, if I have understood properly. jQuery must always be told Where
to go! when called in an HTML document, but knows automatically where
to go when called inside another jQuery method in a JavaScript
document.  Is this correct?

Roddy


[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread kiusau

On May 3, 8:59 am, Ariel Flesler afles...@gmail.com wrote:

 Fixed:http://dev.jquery.com/changeset/6334

This link was very useful.  It taught me that fn in the following
construction means prototype.

(function($) {
  $.fn.someFunctionName function( ) {
  This functions code block
  };
})(jQuery);

So, when I create a jQuery method, I am actually adding a property to
the jQuery object.

Roddy