Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

Is there any way to get value and id of exact upper cell of upper row of html table

$
0
0

I have an HTML table having 10 rows and 10 columns each. If I click on 5th column of 5th row, then I need id and value of exact upper row i.e. 4th row and the exact upper column. I know that by prev() and by next() we can get id and value of previous and next columns. But I am wondering if there is any way to achieve this..

When I click on cell written 55 then I want the value and id of previous row's column written 43

When I click on cell written 53 or 54 or 55 of 5th row then I want the value and id of previous row's column written 43 just because it is the upper column of all 53, 54 and 55 lower columns. Hope I have explained myself...

What I have done so far is

var TdID = $("#HFTdId").val();
            var UpTdID = $("#" + TdID)
                .closest('tr')
                .prev() 
                .children('td')
                .attr('id'); 

This piece of code gives me the 0th column of previous row.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>