How to nest multiple keydown events?
<p>My overall goal is to be able navigate between 3 divs each having CSS id's of #sectionA, #sectionB, and #sectionC using TAB keyboard key . And within each div, I have an unordered list I would like to use the right and left arrow keys to navigate through the list. </p>

<p>My HTML markup is this:    </p>

<pre><code>               &lt;div id="sectionA"&gt;
            &lt;ul id="ul_sectionA"&gt;
                    &lt;li&gt; Section A -  Test B&lt;/li&gt;
                    &lt;li&gt; Section A -  Test B&lt;/li&gt;
            &lt;/ul&gt;
    &lt;/div&gt;
    &lt;div id="sectionB"&gt;
            &lt;ul id="ul_sectionB"&gt;
                    &lt;li&gt; Section B -  Test B&lt;/li&gt;
                    &lt;li&gt; Section B -  Test B&lt;/li&gt;
            &lt;/ul&gt;
    &lt;/div&gt;
            &lt;div id="sectionC"&gt;
            &lt;ul id="ul_sectionC"&gt;
                    &lt;li&gt; Section C -  Test B&lt;/li&gt;
                    &lt;li&gt; Section C -  Test B&lt;/li&gt;
            &lt;/ul&gt;
    &lt;/div&gt;   
</code></pre>

<p>So far, I was able to get the following jquery code but not working once I add the second $(document).keydown(function() code.</p>

<pre><code>  $(document).ready(function()
    {
        var divs = ["sectionA","sectionB","sectionC"];
        var startIndex = 0;

        $(document).keydown(function(e)
        {
            alert("test");
                if (e.which == 9)
            {
                 $("div").css("border", "");
                    $("#"+divs[startIndex]).css("border","1px solid blue");
                var divID = $("#" +divs[startIndex]).attr("id");
                $(document).keydown(function(event)
                {
                    if(event.which == 37)
                    {
                        if("#"+divID+"ul li").addClass() == "highlight")
                        {
                            $(this).next().addClass("highlight");
                        } else
                        {
                            $(this).addClass();   
                        }
                    }
                });
                startIndex++;

                    if(startIndex === divs.length)
                    {
                            startIndex = 0;                  
                    }
                }
        });
    });    
</code></pre>
