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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:35:52+00:00 2026-05-27T16:35:52+00:00

I have a table as follows; <table> <tr> <th scope=col></th> <th scope=col>Column One</th> <th

  • 0

I have a table as follows;

<table>
<tr>
<th scope="col"></th>
<th scope="col">Column One</th>
<th scope="col">Column Two</th>
<th scope="col">Column Three</th>
<th scope="col">Column Four</th>
</tr>
<tr>
<th scope="row">Row One</th>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th scope="row">Row Two</th>
<td></td>
<td></td>
<td class="click"></td>
<td></td>
</tr>
<tr>
<th scope="row">Row Three</th>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th>Row Four</th>
<td></td>
<td></td>
<td class="target"></td>
<td></td>
</tr>
<table>

I would like to be able to click on the <td> with a class of ‘click’ and then alert me as to how many rows away the <td> with a class of target is. (in the above example it would return 2).

There may be other <td> elements in the table with a class of target. I am only interested in the number of rows until the next target in the same row as my ‘clicked’ td. Any targets above my ‘clicked’ <td> or in other columns should be ignored.

If there are no other ‘target’ <td>‘s after the clicked element in the same row, the alert should read ‘no other targets’.

I hope this is clear.

  • 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-27T16:35:52+00:00Added an answer on May 27, 2026 at 4:35 pm

    Do you mean like this?

    var targetRowIndex = $('.target')[0].parentNode.rowIndex;
    
    $(".click").bind("click",function(){
       alert( targetRowIndex - this.parentNode.rowIndex ); 
    });
    

    http://jsfiddle.net/BZDyr/3/

    You can probably implement the rest of the precise functionality yourself if you realize what’s going on in that code.

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

Sidebar

Related Questions

I have a nvarchar(50) column in a SQL Server 2000 table defined as follows:
I have a table as follows <table id=vainTbl6 class=dtable cellpadding=3 cellspacing=1 border=0> <thead> <tr><th>check</td><th>Morphosal</th><th>goat
I have a table as follows <div id=div13 class=ctnr> <table id=mainTable13 class=dtable cellpadding=3 cellspacing=1
I have a table as follows: <table> <tr> <td>col 1</td><td>col2</td> </tr> <tr id=insert> <td>field</td><td>Field
I have a two column table with a primary key (int) and a unique
I have table as follows emp_id, emp_name, emp_address, emp_salary, emp_rating I would like to
I have table as follows emp_id, emp_name, emp_address, emp_salary, emp_rating I would like to
I have a HTML table as follows. I want retrieve row values from this
I have a table as follows > RowID SessionID EventID RequestedURL Date > 1
I have a table like as follows: SoftwareName Count Country Project 15 Canada Visio

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.