I want to lock the focus on pressing the TAB key. So that he remains in my dialogue, I do not press the close button. My JS code is listed below, but it does not work. Can someone help me fix this?
$(function () {
$("#confirmSubmit").keydown(function(e){
if (e.which == 9 ) {
e.preventDefault();
$("#confirm").focus();
}
});
});
Code for dialogue:
// code for dialog
<div style="display: none">
<div aria-live="assertive" aria-describedby="Contentdiv"
role="dialog" id="completeReservationMain" >
<div tabindex="-1" id="Contentdiv">
<div id="CompleteReservationContent">
<h2 tabindex="-1" class="help-layer-heading">
Print </h2>
<div tabindex="-1" class="check-in-complete-help">
Are you sure to Submit?
</div>
<div class="center">
<span class="Button" id="Span1"><span class="ButtonInner">
<form method="get" target="_blank" action="/Print.aspx">
<input type="submit" id="confirm" value="Print">
</form>
</span></span><span class="Button " id="Span2">
<span class="ButtonInner">
<input type="submit" title="Submit" id="confirmSubmit" value="Continue Submit">
</span></span>
</div>
</div>
</div>
. div, "dialog". Tab . ββ "". , , , TAB , .
, TAB, . , .
, , , .