This is just a snippet but I will have many different links on a page. Each link will have a different hidden element associated with it. I\'m trying to avoid writing 100 diff
You could use:
$('.county').click(
function(){
var thisIs = $(this).index();
$('.countystats').eq(thisIs).slideToggle(300);
});
JS Fiddle demo.
Note that I removed the br
from the html to get the index()
accurately. If you need a
elements to be one-per-line, use:
a {
display: block;
}
References: