作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
如何将焦点设置在 html 元素上?
我使用 document.getElementById('ID_HTML_wanted').focus();
但我的 html 元素“ID_HTML_wanted”不是焦点。我使用 jquery api .focus
最佳答案
尝试将您的代码包装到此代码中,以便它在 DOM 准备就绪后执行
$(function(){
//your code
});
所以会变成
$(function(){
document.getElementById('ID_HTML_wanted').focus();
});
但是,您的元素没有 .focus() 方法,如果您想真正使用 jQuery 的方法,请使用
$(function(){
$("#ID_HTML_wanted").focus();
});
关于javascript - jquery 专注于负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7814361/
我有一个 Collection View 并以这样一种方式排列它,即在屏幕的一侧有一个单独的列,并且根据焦点中的集合项替换内容。 如果对某个项目的关注超过 0.5 秒,我希望能够换出内容。 这是我目前
这是一种经常出现的情况,对我来说永远不会太容易。我想我会问其他人如何处理它。 想象一下,如果 demo=60 命令行参数的处理是这样完成的: if DemoOptionSpecified() {
我是一名优秀的程序员,十分优秀!