Finding a common way to slide 'div's by clicking on the buttons for each of them
<p>My HTML consists of lines of text(questions) and a button beside each to show/hide answers.
It is something like this.</p>

<pre><code>&lt;div id="test"&gt;
&lt;ul&gt;
&lt;li&gt;ques 1 &lt;button&gt;view/hide answer&lt;/button&gt; &lt;/li&gt;
  &lt;div id="ans1"&gt;
   Answer 1
  &lt;/div&gt;
&lt;li&gt;ques 2 &lt;button&gt;view/hide answer&lt;/button&gt;&lt;/li&gt;
  &lt;div id="ans2"&gt;
   Answer 2
  &lt;/div&gt;
.
.
.
&lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>What I'm trying to achieve is a single function which can take the id of the clicked button or say the class of button and show/hide the div after it.
Using jQuery I can provide different ids to each and write code for the same but that'll be a foolish thing to do as I have a lot of questions to show. I hope I'm able to explain myself well.
There may be a very easy way to do it but unfortunately I just can't get to it.
Hope someone out there will help me out.</p>
