Skip to content

Commit d07edbb

Browse files
committed
Add note on bug with .index() before 1.9
1 parent a22a743 commit d07edbb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

page/using-jquery-core/understanding-index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ In the first example, `.index()` gives the zero-based index of `#foo1` within it
4040

4141
When `.index()` is called on a jQuery object that contains more than one element, it calculates the index of the first element.
4242

43+
Before jQuery 1.9 you should ensure `.index()` is only passed one element. Due to a bug that existed then, when you pass more its result may be incorrect. That's also the reason we're calling `.first()` every time we use `.index()` in our example.
44+
4345
## `.index()` with a String Argument
4446

4547
```

0 commit comments

Comments
 (0)