Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay item below row in table on click
    primarykey
    data
    text
    <p>I have a table displaying some information. What I'd like to accomplish is to allow the user to click on a row, and have the note related to the info in that row display below that row.</p> <p>I am trying to set it up so that I can use the nifty CSS transition feature, so just putting the note in a hidden, absolutely positioned row below the info row is out of the question. CSS transition doesn't act on the <code>position</code> style.</p> <p>I've got it set up so that the note will be in a <code>div</code>. When the user clicks a row in the table, an <code>onClick</code> event calls up a Javascript function which makes the <code>div</code> visible. Now all I need is for the div to line up under the selected table row.</p> <p>How could I get the table row's height and position? I figure I could use that to position the <code>div</code>. Or, is there a better way to do this?</p> <p>Here's an example of what I've got:</p> <pre><code>&lt;style&gt; .emarNote{ transition: all .3s linear; -o-transition: all .3s linear; -moz-transition: all .3s linear; -webkit-transition: all .3s linear; } &lt;/style&gt; &lt;script type="text/javascript"&gt; function showEmar(id) { if (document.getElementById("emarNote"+id).style.visibility == "hidden") { document.getElementById("emarNote"+id).style.visibility = 'visible'; document.getElementById("emarNote"+id).style.opacity = 1; } else { document.getElementById("emarNote"+id).style.opacity = 0; document.getElementById("emarNote"+id).style.visibility = 'hidden'; } } &lt;/script&gt; &lt;table&gt; &lt;tr onClick="showEmar(1)"&gt; &lt;td&gt;Info&lt;/td&gt; &lt;td&gt;Info&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="emar1" class="emarNote" style="visibility:hidden; opacity:0; position:absolute;"&gt; note about info &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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