必须在两个HTML元素之间移动tabindex

时间:2014-11-19 15:56:57

标签: jquery html5

<div class=" yellow" data-name="notes" title="View Notes">
        <div class="title">
            <h3 id="notesid" >notes</h3>

            <div class="info">
                <a href="#" id="clear-notes" title="Clear notes">Clear</a>
            </div>
        </div>
        <div class="body">

            <div class="content-area notes-area resizeble" style="height: 130px;">

                <textarea   title="Notes" id="notes-textarea" rows="5" cols="15">Notes</textarea>
            </div>

        </div>
    </div>

在这段代码中,我有一个带有两个可聚焦元素的div ----锚元素和文本区域。默认情况下,焦点首先在锚点上,然后在textarea上,但我需要交换焦点。据我所知,Textarea是第一个关注和锚定元素的元素。任何人都可以帮助我...谢谢!!!!

2 个答案:

答案 0 :(得分:0)

不需要jQuery或HTML5,只需要旧的tabindex属性:

&#13;
&#13;
<div class=" yellow" data-name="notes" title="View Notes">
    <div class="title">
         <h3 id="notesid">notes</h3>
        <div class="info"> <a href="#" id="clear-notes" title="Clear notes" tabindex="2">Clear</a>
        </div>
    </div>
    <div class="body">
        <div class="content-area notes-area resizeble" style="height: 130px;">
            <textarea title="Notes" id="notes-textarea" rows="5" cols="15" tabindex="1">Notes</textarea>
        </div>
    </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

您可以使用tabindex

定义订单

e.g。 tabindex="1"

在HTML 5中,这适用于所有HTML元素,它也适用于HTML 4.01。但不是所有类型的元素。

http://www.w3schools.com/tags/att_global_tabindex.asp

相关问题