user6779766 user6779766 - 1 year ago 57
jQuery Question

JQuery Slide function is n't behaving at all for data from DB

I have a database with two tables, each has three rows and both are connected by id. i executed them in .php so that each row in table_1(question) has its replies in table_2(answers).

Ans now i tried to put a SLIDEUP/SLIDEDOWN function for the answers triggered by buttons.
But unfortunately something is missing...

My Code as follows::

<div id="a" name="a">
<small><p><?php echo $row2["date"]; ?></p></small>
<p><B><big><font color= #ba4a00> A:</font></B></big> <small><?php echo $row2["answer"]; ?></small></br></p>

<button class="btn1">Slide up</button>
<button class="btn2">Slide down</button>

<script type='text/javascript'>




Answer Source

If you open your web console, you'll see an error there about trying to call undefined as a function, because of this:


$(this).parent() returns a jQuery object. jQuery objects don't have a $ property.

You probably meant


Side note: From the code, it seems likely to me that this structure containing the div and buttons is repeated more than once on the page. If so, you need to remove the id="a" on the div, as you cannot have the same ID on more than one element.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download