I think you're looking for something along the lines of:
$('.tab, .edit, .cancel').click(function(){
switch($(this).attr("class")className){
case 'tab' : {
$('.tab').removeClass('activeTab');
$(this).addClass('activeTab');
}break;
case 'edit' : {
$(this).hide();
$(this).next().show();
} break;
case 'cancel' : {
$(this).parent().hide();
$(this).parent().prev().show();
} break;
}
});
OLD CODE THAT WAS BROKEN:
$('.tab, .edit, .cancel').click(function(){
switch(this){
case '.tab' : {
$('.tab').removeClass('activeTab');
$(this).addClass('activeTab');
}break;
case '.edit' : {
$(this).hide();
$(this).next().show();
} break;
case '.sample' :
case '.cancel' : {
$(this).parent().hide();
$(this).parent().prev().show();
} break;
}
});