title: detecting the last list item in jquery/javascript
body: <p>I have a set of tab (main-tabs) on a website and each tab has another set of tabs (sub-tabs).
  I want to use arrow keys on a keyboard to navigate the tabs, instead of a mouse.</p>
  
  <p>These tabs are just HTML list items <code>&lt;li&gt;</code></p>
  
  <p>When I reach the last sub-tab with the arrow key, I want it to go back to the next main tab so it can display its own sub-tabs, and carry on the navigation inside it.</p>
  
  <p>My question is, how can I detect, in jQuery/javascript, when I've reached the last list item (tab) using the arrow keys i.e. the right arrow key?</p>
  
  <p>Many Thanks</p>