无法在页面加载事件纯 JS上将焦点设置为输入文本字段

问题描述

我有一个加载/运行到 iframe 的 aspx 文件,其中有一个输入字段(Telerik autocompletebox 控件)。我需要在页面完成加载后输入文本字段获得焦点。我尝试了一些替代方法,但它不起作用。我的代码

<script>
   function pageLoaded() {
      // I tried the following three alternatives
      document.getElementById('Radautocompletebox1').focus();
      $('#Radautocompletebox1').focus();
      $('#Radautocompletebox1').get(0).focus();
   }
</script>

<body onload="pageLoaded()">

知道为什么它不起作用吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)