I've written this code below for a mobile navigation. Everything works well, but when opening a UL i want the other UL's to close. Does anyone know how to write this?

fiddle code:- <http://jsfiddle.net/t7gucozm/4/>

```
$('nav > ul li a').on('click', function (ev) {
    if ($(this).next('ul').length > 0) {
        if ($(this).hasClass('opened')) {

        } else {
            $(this).addClass('opened');
            $(this).next('ul').show();
            ev.preventDefault();
        }
    } else {

    }
});

```