I want to hide all child elements in a div. And then show a specific one passed on to the function.
function subDisplay(name) {
$("#navSub").each(function() {
$(this).hide();
});
$(name).show();
}
then i call the function from an onmouse event like: subDisplay(#DivIwantToShow);
But nothing displays...
What am i doing wrong?
You need to hide the children and not the containing div.
$("#navSub").children().hide();
So now if the div you are trying to show is an element in the parent div it will still show while the others stay hidden.