Binding events inside click method
<p>I was told previously that I should not bind events inside of a function. What would be my best option to get around this current issue? I click on a link and from that link I want to get some properties. Here is how I am currently doing it.</p>

<pre><code>$(".portfolioLink").click(function(){

            // Show slide and portfolio piece info
            $(".inner-content.portfolio").show();

            // Reset slides timer and pagination
            clearInterval($('#slides').data('interval'));
            $("ul.pagination li").removeClass("current");

            // Get ID from link that is clicked.
            var slideID = $(this).parent().attr("id");

            $("#previous").click(function() {
                slideID--;
                clearInterval($('#slides').data('interval'));
                $("ul.pagination li").removeClass("current");
                portfolioSwitch(slideID);
            });

            $("#next").click(function() {
                slideID++;
                clearInterval($('#slides').data('interval'));
                $("ul.pagination li").removeClass("current");
                portfolioSwitch(slideID);
            });
}
</code></pre>

<p>I have two buttons that go back and forth which are the next and previous buttons. Depending on what link I click, I want to go forward or back. What's the best way of having these click events outside of the <code>$(".portfolioLink")</code> click event and at the same time get those properties from the portfolio link?</p>
