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 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, Lets say I have gather a random selection of users: User.find(:all, :limit =>
Good Afternoon All, I have a table inside a div. The div has a
Good afternoon people's I have built a jquery plugin that I use on my
Afternoon, I wish to pass the row number of a table to a function
Good afternoon, I have a web query in Excel 2002 going against a web
I have weather forecast data formatted like so: loc_id#location#state#forecast_date#issue_date#issue_time#min_0#max_0#min_1#max_1#min_2#max_2#min_3#max_3#min_4#max_4#min_5#max_5#min_6#max_6#min_7#max_7#forecast_0#forecast_1#forecast_2#forecast_3#forecast_4#forecast_5#forecast_6#forecast_7# 090180#Airey's Inlet#VIC#20091204#20091204#161830###12#19#12#21#12#19#12#17#11#20#12#20#11#17#Mostly clear.#Shower or two.#Light
Good afternoon. Before I begin my explanation, I have had a look at other
I have a mysql table with users and their weekly calendar. Every user can
Afternoon all. A very simple one for you today from thicky Rich. I have
Afternoon. I have several SQL Agent jobs running on an MS 2K8 BI server,

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.