【问题标题】:Tab Focus not reflecting in Mozilla标签焦点未反映在 Mozilla 中
【发布时间】:2015-09-02 14:16:07
【问题描述】:

以下元素的选项卡焦点在 Mozilla 中不起作用:

    <div class="editor-field">
                        <div>
                            <%: Html.TextBox(model => model.AddressLine1, new { maxLength = 30, style = "width:300px", tabindex = "0" })%>
                        </div>
<div class="editor-field">
                        <div>
                            <%: Html.TextBox(model => model.AddressLine2, new { maxLength = 30, style = "width:300px", tabindex = "0" })%>
                        </div>

<div class="editor-field">
                        <div>
                            <%: Html.TextBox(model => model.AddressLine3, new { maxLength = 30, style = "width:300px", tabindex = "0" })%>
                        </div>

我的 CSS 是:

editor-field > div > input:focus
{
     outline: 1px dotted red !important;
}

我可以知道我错在哪里。默认选项卡导航在 Mozilla Firefox 中不起作用。在 Chrome 和 IE 中运行良好。请协助我解决此问题。

【问题讨论】:

  • 感谢 Vaibhav 的回复。但我的 CSS 设置如下: editor-field > div > input:focus { outline: 1px dotted red !important; -moz-user-focus:正常; } 但它在 Mozilla 中不起作用。如何设置我的 CSS??

标签: html css model-view-controller


【解决方案1】:

您必须使用 Jquery 或 Javascript 来设置焦点,例如:-

$(document).ready(function() {
    $('.editor-field').first().children().children('input').focus();
});

【讨论】:

  • 老兄..感谢您的回复。我已经尝试过您的解决方案,但它不起作用。我想要的是当我通过键盘的 Tab 键正常导航时应该发生焦点。我使用 Firefox 时遇到的问题。你能帮我通过更改 CSS 来解决吗。对 JS 和 Jquery 不太友好?
  • 我也试过这个链接:support.mozilla.org/en-US/questions/1034567 但没有解决方案。
  • 你能给我你使用它的页面的链接吗?
  • 对不起 Dheeraj。我无法为您提供该链接。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-06-25
  • 1970-01-01
  • 2020-08-28
  • 1970-01-01
  • 1970-01-01
  • 2022-07-07
  • 1970-01-01
相关资源
最近更新 更多