Jquery Menu not collasping on mouseleave

Jquery Menu not collasping on mouseleave

Hi, i'm pretty new to Jquery and Javascript, and have recently started dwelling into jquery. Well the problem that i have, is that with .menu() function, i want the submenu to collapse when i exit the submenu, but instead it waits there till i click something. I have tried to checked the jquery code to find anything, and found the function, which is for closing submenu on click outside the menu. i tried different methods to achieve this, such as mouseleave() hover. But everything failed. Now im here, asking how you guys would acheive this using menu widget and jquery?

Thank you.