Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery / PHP: Show more infos between two rows using slideToggle
    text
    copied!<p>I am nearly finished with my event-table, but one last thing needs to be done. I've a table created and now I want to show infos by clicking on an event.</p> <p>My actual code is without slideToggle. If you click on an event, it opens the event on a new page and I am not lucky with it. I want to open the additional infos of the events below the row.</p> <p>Here is the actual code (updated):</p> <pre><code>&lt;?php $query = "SELECT `id`, TIME_FORMAT(doors,'%H:%i') AS `doors`, TIME_FORMAT(begin,'%H:%i') AS `begin`, `category`, `who`, `infos`, `location`, `smoke`, `dogs`, DATE_FORMAT(date,'%d.%m.%Y') AS `de_date` FROM `events` WHERE `status` = 'enabled' ORDER BY `date` ASC"; $events_resource = mysql_query($query) or die(mysql_error()); ?&gt; &lt;table class="tableLine"&gt; &lt;tr&gt; &lt;th&gt;Wann?&lt;/th&gt; &lt;th&gt;Was?&lt;/th&gt; &lt;th&gt;Wer?&lt;/th&gt; &lt;th&gt;Wo?&lt;/th&gt; &lt;/tr&gt; &lt;?php $all_events = array(); $ten_events = array(); for($i = 0; $events = mysql_fetch_object($events_resource); $i++){ if($i &lt; 9){ $ten_events[] = $events; } $all_events[] = $events; } $i = 0; foreach($ten_events as $event): ?&gt; &lt;tr class="row" class="show_button" href="#"&gt; &lt;td&gt;&lt;?=$event-&gt;de_date?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=$event-&gt;category?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=$event-&gt;who?&gt;&lt;/td&gt; &lt;td&gt;&lt;?=$event-&gt;location?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="eventinfos" colspan="4"&gt; &lt;?=$event-&gt;infos?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach; ?&gt; &lt;/table&gt; &lt;script&gt; $(document).ready(function(){ $('.eventinfos').hide(); $('.show_button').click(function(){ $(this).closest('.row').find('.eventinfos').slideToggle(); }) }) &lt;/script&gt; </code></pre> <p>Well, I don't really know, where to put the hided infos (using a div?) and which slideToggle-code I need to use and where to put it. I did some tries with this code, but my knowledge is not good enough.</p> <p>Here is my Photoshop-example how I want it: <img src="https://i.stack.imgur.com/ob2xj.png" alt="enter image description here"></p> <p>I hope you can help me out.</p>
 

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