Note that there are some explanatory texts on larger screens.

plurals
  1. POFold/unfold only the div I select instead of all?
    primarykey
    data
    text
    <p>Greetings,</p> <p>I am a newbie who just started with jQuery. I am building a basic PHP app for our team that displays a list of open helpdesk tickets. </p> <p>To avoid cluttering the screen, I only want to display the title of the ticket and if clicked, its description.</p> <p>Here's my code </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Animate my Div&lt;/title&gt; &lt;style type="text/css" media="screen"&gt; a { text-decoration: none; } #expand { background-color: #fff; } #mydiv { display: none; } &lt;/style&gt; &lt;script src="jquery-1.3.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("a").click(function(){ $("div").slideToggle(1000); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $con = mysql_connect("korg", "joe", "bob"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("wfr11", $con); $result = mysql_query(" select title, description from webcases"); while ($row = mysql_fetch_array($result)) { ?&gt; &lt;p&gt;&lt;a href="#expand"&gt;&lt;?php echo $row['title']; ?&gt;&lt;/a&gt;&lt;/p&gt; &lt;div id="mydiv"&gt;&lt;?php echo $row['description']; ?&gt;&lt;/div&gt; &lt;?php } mysql_close($con); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Right now, my code works but unfolds all the divs for all open tickets, regardless of what ticket name I clicked. </p> <p>Ideally, I'd like to show the description of for the ticket name I clicked. Not all of them. Is it possible?</p> <p>Thanks for your help.</p>
    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