Note that there are some explanatory texts on larger screens.

plurals
  1. POAbsolutely Position DIV to the right of the last selected (by class) TD cell in a table row
    primarykey
    data
    text
    <p>I have a table like this;</p> <pre><code>&lt;table class="std-table"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;DATA&lt;/td&gt;&lt;td&gt;DATA&lt;/td&gt; &lt;/tr&gt; &lt;tr class="selected-trial"&gt; &lt;td&gt;DATA&lt;/td&gt;&lt;td&gt;DATA&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;DATA&lt;/td&gt;&lt;td&gt;DATA&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; </code></pre> <p></p> <p>I also have a div on the same level that has an image (arrow) as it's background:</p> <pre><code>&lt;div class=selected-trial-marker&gt;&lt;/div&gt; </code></pre> <p>The CSS is controls the basics of the marker element but what I haven't assigned is top and left values. What I'm trying to do is when the page is ready use JQuery to find out the position of the 'selected' row and position the marker element to the right of it.</p> <p>This is my code thus far:</p> <pre><code>$('table.std-table tbody tr.selected-trial td:last').ready(function(){ var offset= $('table.std-table tbody tr.selected-trial').offset(); var leftOffset = $('table.std-table').width(); leftOffset += offset.left +42; var topOffSet = (offset.top); topOffSet = topOffSet+3; $('.trial-selection-marker').css({'top':topOffSet+'px', 'left':leftOffset+'px'}).fadeIn('slow'); }); </code></pre> <p>I'm at a loss as my offset keep coming back as null. In my CSS the table has a width of 100% within a cell that is 300px but the TD cells themselves do not have a width assigned to them (does that matter as I'm targetting the row?) Perhaps I've stared at this for too long and the answer is obvious but can anyone please help?</p> <p>Many thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload