Toggling forms with a single function

Toggling forms with a single function
0

#1

I have a page that has 4 <a> tags. Each tag is then associated with a toggle function. I have basically written each one like so

    $("#formButton1").click(function(){
        $("#form1").toggle();
    });

The problem is, I have four of these. Is there a way to write one function that will toggle each form when it is clicked, and when another one is clicked, close the previous one? I read that I need to set data attributes to each form? Looking for any guidance.


#2

lOOK AT THIS LINK
http://jsfiddle.net/audetwebdesign/4FWMe/


#3

Does the link above help at all?