admin管理员组

文章数量:1202361

I was looking at the documentation page for jScroll plugin for jQuery () and I noticed this :

$(...).scrollTo( $('ul').get(2).childNodes[20], 800 );

So, what does the three dots in jQuery mean ? I have never seen this selector before

EDIT :

DOM Element

This is from the source HTML. Viewing the source for the following links :

Relative 
selectorjQuery 
objectDOM 
ElementAbsolute 
numberAbsolute

all give the same implementation.

EDIT : I didnt look at the attribute clearly, its for the title attribute. I assumed its the href attribute. Feel silly asking this question now :) Thanks for the answers

I was looking at the documentation page for jScroll plugin for jQuery (http://demos.flesler.com/jquery/scrollTo) and I noticed this :

$(...).scrollTo( $('ul').get(2).childNodes[20], 800 );

So, what does the three dots in jQuery mean ? I have never seen this selector before

EDIT :

DOM Element

This is from the source HTML. Viewing the source for the following links :

Relative 
selectorjQuery 
objectDOM 
ElementAbsolute 
numberAbsolute

all give the same implementation.

EDIT : I didnt look at the attribute clearly, its for the title attribute. I assumed its the href attribute. Feel silly asking this question now :) Thanks for the answers

Share Improve this question edited Feb 10, 2012 at 12:17 YD8877 asked Feb 10, 2012 at 12:03 YD8877YD8877 10.8k20 gold badges69 silver badges97 bronze badges 7
  • 3 It basically is a placeholder for your selection. – rickyduck Commented Feb 10, 2012 at 12:06
  • It's hardly a valid selector. My best guess is they wanted to say "any selector" ;) – Jovan Perovic Commented Feb 10, 2012 at 12:06
  • ... - just for example.Three dots doesn't exits. – Oyeme Commented Feb 10, 2012 at 12:07
  • +1: It's a fair question, and one that I don't think has been asked before. – Lightness Races in Orbit Commented Feb 10, 2012 at 12:08
  • 1 @jperovic: More to the point, since it's not in quotes, it's not a selector at all, it's invalid JavaScript syntax. So clearly a placeholder. – T.J. Crowder Commented Feb 10, 2012 at 12:09
 |  Show 2 more comments

5 Answers 5

Reset to default 11

I am fairly certain that he was using that as an example.

$( ... ) would be akin to $( your-selector-here ).

In other words, I have never seen any implementation of that.

Typically ... is used in various docs to shorten the example, and it means that you put something in place of the dots, or that what you would put there was omitted (to shorten the example)

It's not actually valid JS syntax.

It has no meaning. They meant just write your own selector. Check out the souce code

$('div.pane').scrollTo( 0 );

They are not syntactically correct. They are just way the author uses to say scroll to some element, the name of which I don't bother to write here so I just write dots. Check the source code of the page if in doubt.

Three dots in javascript is Spread Syntax see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals)

本文标签: javascript (three dots) in jQueryStack Overflow