I am creating a page and and it has multiple forms on each page. The forms are hidden but there is a link to each form. When the user clicks the link with the associated form than that form pops open in a lightbox, using colorbox.js. I have it working when only one form is on the page but I don't know how to create a script that works for multiple forms on one page. My script is:
<script>
jQuery(document).ready(function() {
$(".myForm").hide();
$(".link_to_form").click(function() {
$(".myForm").show();
});
$(".link_to_form").colorbox({
width: "50%",
inline: true,
opacity: ".5",
href: ".myForm",
onClosed: function() {
$(".myForm").hide();
}
});
});
</script>
The link that the user clicks on has a class of "link_to_form" and the actual form is in a div with the class of "myForm". Each form also has a specific id associated with it. So when a user clicks on the "register" form the form associated with that needs to pop up. Right now, if the user clicks on a link to any form all of the forms open in a lightbox.