I'm not sure how to entitle my question correctly, but here is the problem:
I have a number of div elements on a page and trigger links pointing to each of those elements with anchor ids. Those elements will work as popups.
<a href="#pop1" class="trigger" id="t1">Show Popup #1</a>
<a href="#pop2" class="trigger" id="t2">Show Popup #2</a>
<a href="#pop3" class="trigger" id="t3">Show Popup #3</a>
<div id="pop1" class="popup">...content here...</div>
<div id="pop2" class="popup">...content here...</div>
<div id="pop3" class="popup">...content here...</div>
Now what is the effecient way to associate multiple links to divs for toggling them on link click? Coding them one by one is not a good option because there can be too many elemens on a page.
$("#t1").click(function(){
$("#pop1").toggle();
});