If you want to select all same level elements without the ones with specific class in jQuery you can do the following:
$(".tab li[class!=selected]").hover(
function () {
$(this).addClass("selected");
},
function () {
$(this).removeClass("selected");
}
);
or
$(".tab li:not(.selected)").hover(
function () {
$(this).addClass("selected");
},
function () {
$(this).removeClass("selected");
}
);
In the examples above we were assigning class 'selected' to all tabs that were not already selected( elements that not has the class .selected)