0

I have a Div which is positioned via javascript.

$("#'+customer.Id+'").css({
        left: customerOffset,
        width: customerWidth- endDayOffset,
        height: document.getElementById("Planning").rows[0].clientHeight,
        display: "normal",
        position: "absolute"
    });
    $("#'+customer.Id+'").offset({ top: bottomTop })

This div is placed on a table cell with a certain Id. This Id I want to obtain. How is this possible?

1 Answers1

0

Use the jquery .parents() method to find the ancestor table cell.

$("#'+customer.Id+'").parents("td#' + tableCell.Id + '");

Turns out you're asking about similar coordinates.

This Post might be able to help you.

Community
  • 1
  • 1
steinmas
  • 398
  • 3
  • 9
  • I just re-read your question. When you say on top of a table cell, do you mean the html is within that table cell, or it just looks like it's on top of it? – steinmas Aug 20 '14 at 20:42
  • I think the poster is looking for the element where the coordinates overlap, not the DOM tree position. – Diodeus - James MacFarlane Aug 20 '14 at 20:42
  • [This might be able to help him](http://stackoverflow.com/questions/8457082/how-to-select-elements-based-on-xy-coordinates-not-using-mouse-drag-with-jque) – steinmas Aug 20 '14 at 20:47
  • Yes Diodeus, thats what I meant. Because the div isn't placed inside the html of the table cell. The link of Steinmas helped me. Thanks – allardsoeters Aug 21 '14 at 07:21