jquery - variable nth-child?

Viewed 34787

Hey. I want to pass a variable as an argument into an nth-child selector.
This doesn't work:

var position = 5;

$("#daddy > div:nth-child(position)").animate({
    opacity: 0.01,
}, 500);​

Is it possible though? Cheers, Jack

3 Answers
Related