function selectNextItem(direction) {
        var $links   = $dropdown.find("a"),
            index    = $dropdownItem ? $links.index($dropdownItem) : (direction > 0 ? -1 : 0),
            $newItem = $links.eq((index + direction) % $links.length);

        if ($dropdownItem) {
            $dropdownItem.removeClass("selected");
        }
        $newItem.addClass("selected");

        $dropdownItem = $newItem;
        removeDeleteButton();
    }
function selectNextItem(direction) {
        var $links   = $dropdown.find("a"),
            index    = $dropdownItem ? $links.index($dropdownItem) : (direction > 0 ? -1 : 0),
            $newItem = $links.eq((index + direction) % $links.length);

        if ($dropdownItem) {
            $dropdownItem.removeClass("selected");
        }
        $newItem.addClass("selected");

        $dropdownItem = $newItem;
        removeDeleteButton();
    }
function selectNextItem ( direction ) { var $links = $dropdown . find ( "a" ) , index = $dropdownItem ? $links . index ( $dropdownItem ) : ( direction > 0 ? - 1 : 0 ) , $newItem = $links . eq ( ( index + direction ) % $links . length ) ; if ( $dropdownItem ) { $dropdownItem . removeClass ( "selected" ) ; } $newItem . addClass ( "selected" ) ; $dropdownItem = $newItem ; removeDeleteButton ( ) ; }
Selects the next or previous item in the list
@param {number} direction  +1 for next, -1 for prev
Selects the next or previous item in the list
select next item