jQuery: Pass variable to :eq() does not work
javascript, jquery
Solution
You have to concatenate your variable with your selector:
$("tr:eq("+selected+")");
Problem
I have been trying to find out why the following lines of code do not work: ``` $('#add-cloud > select').change(function() { var selected = parseInt($('#add-cloud select option:selected').val()); $("#cloud-calculator table tr:eq(selected)").css("color", "red"); }); ``` If I change `:eq(selected)` to `:eq(4)` for example - works fine. How do you pass variable as an argument to `:eq()` ?