Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3973972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:30:48+00:00 2026-05-20T04:30:48+00:00

HTML: <ul> <li>Help</li> <li>me</li> <li>Stack</li> <li>Overflow!</li> </ul> <br> <ul> <li>Can</li> <li>I</li> <li>connect</li> <li>these?</li> </ul>

  • 0

HTML:

<ul>
    <li>Help</li>
    <li>me</li>
    <li>Stack</li>
    <li>Overflow!</li>
</ul>

<br>

<ul>
    <li>Can</li>
    <li>I</li>
    <li>connect</li>
    <li>these?</li>
</ul>

Javascript/JQuery:

$("li").live('click', function(){

alert($(this).index());

});

I put together a simple jsfilled page to help describe my problem: http://jsfiddle.net/T4tz4/

Currently clicking on an LI alerts the index relative to the current UL group. I’d like to know if it was possible to get a ‘global index’ so that clicking on “Can” returns the index value of 4.

Thank you,
John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:30:49+00:00Added an answer on May 20, 2026 at 4:30 am

    Just put the 'li' selector inside index()

    $('li').live('click', function() {
        alert( $(this).index('li') );
    });
    

    Live demo: http://jsfiddle.net/T4tz4/3/


    http://api.jquery.com/index/

    If a selector string is passed as an
    argument, .index() returns an integer
    indicating the position of the
    original element relative to the
    elements matched by the selector.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using Stack Overflow, so if I've done something wrong
I have tried setting this up based on previously asked questionshere on stack overflow
First of all, this is my first post in Stack Overflow and I'm trying
I've gone through various tutorials and Stack Overflow posts and understand that Selenium can
I've checked the related questions on stack overflow, but can't seem to find an
With the help of a Stack Overflow user named Michael, I was able to
I'm looking for an HTML Parser module for Python that can help me get
I have an HTML help system that I need to convert to SharePoint. The
I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
My URL is: http://www.metroflatsmiami.com/listing/add.html Any help?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.