JSFiddle - React, Tailwind, and code Playground

HTML

<select id="my_element_id">
    <option>Alex</option>    
    <option selected="selected">IS</option>
    <option>Cool</option>
</select>

JavaScript

var selectedIndex = $('#my_element_id :selected').index();

if(selectedIndex  > -1)
{
    selectedIndex = selectedIndex + 1; //index() is 0 based, nth-child is 1 based
    
    var prevIndex = selectedIndex - 1;
    var nextIndex = selectedIndex + 1;
    
    var prev = $('#my_element_id :nth-child(' + prevIndex  + ')').val();
    
    var next= $('#my_element_id :nth-child('+  nextIndex + ')').val();
    
    alert(prev || "no previous");
    alert(next || "no next");
}