-1

I'm totally new to jQuery, so maybe this is an easy question, but i havent found a good answer till now. Maybe i havent even found the right keywords to search for...

By click on a list-item i display a dropdown-menu with the folllowing function:

$("li.dropdown").click(function(){
    $('.dropdown-menu',this).css("display","block");
});

Works fine, but the dropdown keeps stayin. Now i want the dropdown-menu to hide again, when i

a) click on another li.dropdown (and then the new dropdown-menu must appear) or b) click somewhere else on the page

I get it to work when i click somewhere else on the page than li.dropdown, but not when i click on another li.dropdown (respectively then it doesnt show the "new" dropdown-menu of the newly clicked li).

Thanks in advance!

4

1 に答える 1