加载页面时调用拼写检查

问题描述 投票:0回答:1

我在IE 11上创建一个HTML textarea表单,当加载页面时,表单将填充数据库中的值。当用户开始输入时,浏览器将进行拼写检查,但是当用户加载页面时,textarea中的文本没有拼写检查。

在onload上有没有办法强制添加红色拼写检查下划线?

javascript html
1个回答
0
投票

将自动对焦添加到元素。

<textarea id="myTextArea" spellcheck="true"  autofocus="autofocus">Ths is the text from the dtabase that's loaded on page load.</textarea>

对于Internet Explorer,请尝试this

$(function() {
  $('[autofocus]:not(:focus)').eq(0).focus();
});
© www.soinside.com 2019 - 2024. All rights reserved.