attaching a command to an id or class

attaching a command to an id or class

Hi folks:

I have repetitive code, along the lines of 
$('#id or .class").delay(800).fadeOut(1200).

I could do
function fadeIt(id) {
$('#' + id). delay(800).fadeOut(1200);
}
but is there a way of specifying a class as well, in the same function? 
or does doing it to a class have to be a separate function?

cheers.