[jQuery] Smarter way to write this repetitive code?
$('.headline:eq(0)').click(function() {
$('.article-text:eq(0)').fadeIn();
});
$('.headline:eq(1)').click(function() {
$('.article-text:eq(1)').fadeIn();
});
$('.headline:eq(2)').click(function() {
$('.article-text:eq(2)').fadeIn();
});
Is there a smarter way to write that so it wasn't so repetitive?
It is in practice here: http://css-tricks.com/i/
I'd like to be able to add and remove headlines without adding these
chunks of code if possible.