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 7675119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:53:22+00:00 2026-05-31T16:53:22+00:00

Maybe it is just a simple mistake but this thing is driving me crazy.

  • 0

Maybe it is just a simple mistake but this thing is driving me crazy.
I want to know why the hell this jQuery line is returning -1?

$('td[class!="traco"]:last').index('td.diaNormal')

First of all, when this function returns a negative number? Why does it happen?
Thank you all in advance, Fernando.


EDIT:

The most intersting thing is that my page has the element i am looking for, and the
jQuery index just returns -1.


EDIT2:
This is my HTML, http://jsfiddle.net/bv7SU/

  • 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-31T16:53:24+00:00Added an answer on May 31, 2026 at 4:53 pm

    It is pretty standard in programming models when doing searches / finds that return indexes to indicate a “not found” with a negative number of minus one (-1) (naturally, because the indices will start from zero (0)). So, what you’re seeing is the result of a successful call (in the sense that it worked) that just didn’t find anything to match your criteria.

    If this wasn’t the case, how exactly would you determine whether something was found or not? There often needs to be a distinction between “this worked!“, “this worked, BUT…“, and “this failed!“.

    Sometimes there will be an alternative, such as a method just so named and documented to behave almost the same the other, but with the difference of “throw an exception on ‘worked, BUT’“, which is also often useful. But you generally need to be on the lookout for the latter modes as and when you need them.

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

Sidebar

Related Questions

Maybe this is a simple problem, but I am just not seeing it :)
May be its a simple question but it's really driving me crazy. I just
Very simple questions guys, but maybe I'm just forgetting something. In 64bit linux, a
Maybe I'm just missing something simple, but it doesn't seem like anyone else has
Maybe I just haven't figured out the InfoPath paradigm yet, but any links, or
Maybe I just don't know enough about structs and have been using them blindly
I'm interested in texture streaming in DirectX but google seems unhelpful. Maybe I just
Maybe I am just over thinking this and need to write some more prototype
I am hoping this is a simple stupid noob mistake that can be fixed
For instance, like Font. Can anyone give a very simple example? Maybe just a

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.