Skip to content

Instantly share code, notes, and snippets.

@jikeytang
Created July 10, 2014 23:24
Show Gist options
  • Save jikeytang/5c0e699d88111bc61348 to your computer and use it in GitHub Desktop.
Save jikeytang/5c0e699d88111bc61348 to your computer and use it in GitHub Desktop.
[ jQuery ] - 20140711-题目1
请说出以下的区别:
1. $('p').get(),
2. $('p')[1],
3. $('p').eq(0),
4. $('p').index()
PS:
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。
```javascript
// you code
```
2. 粘贴代码时请使用shift+tab,缩进前面的空白。
@zhouwenhong
Copy link

$('p').get()

获取文档所有p标签元素的数组

$('p')[1]

获取文档第二个p标签元素

$('p').eq(0)

获取文档第一个p标签元素的jQuery对象

$('p').index()

获取文档最后一个p标签元素相对于其第一个兄弟节点的位置

Demo演示

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment