# Query Index

**URL:** <https://forum.kirupa.com/t/query-index/296718>\
**Category:** web dev\
**Created:** [September 18, 2009, 9:08pm UTC](https://forum.kirupa.com/t/query-index/296718 "2009-09-18T21:08:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)\
**Post date:** [September 18, 2009, 9:08pm UTC](https://forum.kirupa.com/t/query-index/296718/1 "2009-09-18T21:08:24Z")

</div>

I’ve been spending waaaay to much time trying to figure this out.

How do you get the index of the first element inside of a class.

```auto
var lastExpanded = $(".expandableText").index("ul:first");

```

So I have a div with a a few UL inside of them. The first case of UL would be 0 normally, but if I had another div before with a UL in it, then it would have a different index altogether. The only code I can find related to this talks about $(this) and I can’t get it to work.

[http://brandonaaron.net/blog/2009/05/7/jquery-edge-versatile-index](http://brandonaaron.net/blog/2009/05/7/jquery-edge-versatile-index)
