addClass to some elements of a list

addClass to some elements of a list

Hello, 


I need to add a class of some elements of a list (#list). I have the index of these elements in a list (#indexlist), and using this I want to add a class of each appropiate element. 


I did this:


$("#indexlist li").each(function(){

var element = $("#list li").get("#indexlist li");
element.addClass("newclass");

});

Of course it doesn't work. 

What I did wrong?