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

  • Home
  • SEARCH
  • 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 6205003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:11:41+00:00 2026-05-24T05:11:41+00:00

Afternoon, say I have a table like so <table id=foo> <tr><td><!– label –><!– textbox

  • 0

Afternoon,

say I have a table like so

<table id="foo">
  <tr><td><!-- label --><!-- textbox --></td><tr>
  <tr><td><!-- label --><!-- textbox --></td><tr>
  <tr><td><!-- label is bar --><!-- textbox --></td><tr>
  <tr><td><!-- label --><!-- textbox --></td><tr>
  <tr><td><!-- label --><!-- textbox --></td><tr>
</table>

how could I in JQuery determine the index of the row that has had it’s textbox amended (on blur)? So if a user adds a value to the textbox on the third row (“label is bar”) I could alert the row index (in this case 2)?

I’m assuming I’d get the table id, perform an each on the tr, then find the text box using children and when that child has it’s onblur event activated we then use parent to output the index?

Any ideas?

Thanks

  • 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-24T05:11:42+00:00Added an answer on May 24, 2026 at 5:11 am
    $("input[type=text]").blur(function() {
        alert($(this).closest("tr").index());
    });
    

    This attaches the blur event to all input elements with type="text". You might want to narrow down that selector to only select inputs inside your table.

    In the event handler function, it gets the closest tr (that is, the first ancestor element of this which is a tr, and gets the index of that).

    Here’s an example fiddle showing it in action.

    As noted in another answer, you may actually be looking for the change event, rather than the blur event as you say in your question. The change event will fire when the value of the input actually changes, as opposed to whenever it loses focus. If that’s the case, simply change the word blur to change.

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

Sidebar

Related Questions

Afternoon chaps, Trying to index a 1.7million row table with the Zend port of
Afternoon all. Another hour, another question! I have the following bit of jquery up
Good afternoon in my timezone. I have a table with four tr and each
Afternoon, I wish to pass the row number of a table to a function
Afternoon, Lets say I have gather a random selection of users: User.find(:all, :limit =>
Afternoon Developers, I have a problem that's beginning to get on my wick. I
Afternoon, I am trying have an HTML file containing a frameset which contains two
Good afternoon, I have a web query in Excel 2002 going against a web
Afternoon, I have been working with CKEditor and CKFinder for the last few days
Afternoon all. I have the following scenario: I have a search page where by

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.