Jquery show and hide
<p>I make this code to show and hide p tag depend on the link click but what if i have 100 p and links i want an easier way to make it dynamically </p>

<pre><code>&lt;div class="example2"&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce facilisis sagittis lectus. Curabitur quam arcu, adipiscing quis pretium in, pharetra eget dolor.&lt;/p&gt;
&lt;/div&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        $('.example2').hide().before('&lt;a href="#" id="toggle-example2" class="button"&gt;Open/Close&lt;/a&gt;');
        $('a#toggle-example2').click(function () {
            $('.example2').slideToggle(1000);
            return false;
        });
    });
&lt;/script&gt;




&lt;div class="example3"&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce facilisis sagittis lectus. Curabitur quam arcu, adipiscing quis pretium in, pharetra eget dolor.&lt;/p&gt;
&lt;/div&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        $('.example3').hide().before('&lt;a href="#" id="toggle-example3" class="button"&gt;Open/Close&lt;/a&gt;');
        $('a#toggle-example3').click(function () {
            $('.example3').slideToggle(1000);
            return false;
        });
    }); 
</code></pre>
