Muhammad Nasir Muhammad Nasir - 11 months ago 63
CSS Question

Tab index with bootstrap pop up modal menu

I have an html page how can i specify tab index for bootstrap popup modal and main differently .

If popup is open table index should be available for popup modal only.
But when i click on last element of popup modal tab transfer control to main page.

<a href="#">first element</a>
<a href="#" >last element in popup</a>

when i press tab on last a it should transfer focus to first element instead of transferring to main page content

Answer Source

add id to select in dom

 <a href="#" id="first">first element</a>
<a href="#" id="last" >last element in popup</a>

Check if event raised by last a is tab then set focus to first element

  <script type="text/javascript">
            document.getElementById('last').onkeydown = function(e){
                if (e.keyCode == 9) {