jQuery焦点功能在Firefox中不起作用

编程入门 行业动态 更新时间:2024-10-11 21:31:38
本文介绍了jQuery焦点功能在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

下面的代码段在单击链接后将重点放在文本输入上.它适用于Chrome 2.x,IE8和Opera 9.64,但不适用于Firefox 3.0.9.文本输入在Firefox中快速闪烁,然后消失,我目前在Windows XP SP2上工作.

The following piece of code focuses the text input after you click on the link. It works fine for Chrome 2.x, IE8 and Opera 9.64 but not on Firefox 3.0.9. The text input flashes quickly in Firefox then disappears, I'm currently working on Windows XP SP2.

<script type="text/javascript" src="ajax.googleapis/ajax/libs/jquery/1.3/jquery.min.js"></script> <script> $(document).ready(function() { $("a").click(function() { var field_id = $(this).attr("href"); $(field_id).focus(); }); }); </script> <a href="#text_field">Focus</a> <input type="text" name="text_field" id="text_field" />

有人知道如何在Firefox中处理上述问题吗?

Does anyone know how to handle the above in Firefox?

推荐答案

我不知道这是不是您想要的.要专注于输入,请点击标签,您可以执行以下操作:

I don't know if is this you want. To put focus on the input clicking on the label you can do this:

<label for="text_field">Label</label> <input type="text" name="text_field" id="text_field" />

OR

<label>Label <input type="text" name="text_field" id="text_field" /> </label>

更多推荐

jQuery焦点功能在Firefox中不起作用

本文发布于:2023-11-27 22:37:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639884.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   功能   焦点   jQuery   Firefox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!