如果使用 javascript 创建,则无法在 ie 11 中输入输入类型文本! :(
input type text cant be typed into in ie 11 if created using javascript! :(
这是我创建的最简单的示例,在 ie 11 中不起作用:(
它实际上不会让我输入文本输入!
<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
var text = document.createElement('input');
text.type = 'text';
document.documentElement.appendChild(text);
</script>
</body>
</html>
我怎样才能解决这个荒谬的错误?
我正在构建一个复杂的网站,该网站使用 javascript 生成大部分 html。
去过那里...我不得不将注意力集中在输入上。
$("input").click(function(){ $(this).closest('input').focus()})
document.documentElement
将成为您的 html 页面,并且您正在尝试将元素附加为 documentElement
的 innerHTML 的同级元素。
而不是 documentElement
使用 body
:
var text = document.createElement('input');
text.type = 'text';
document.body.appendChild(text);
这是我创建的最简单的示例,在 ie 11 中不起作用:( 它实际上不会让我输入文本输入!
<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
var text = document.createElement('input');
text.type = 'text';
document.documentElement.appendChild(text);
</script>
</body>
</html>
我怎样才能解决这个荒谬的错误? 我正在构建一个复杂的网站,该网站使用 javascript 生成大部分 html。
去过那里...我不得不将注意力集中在输入上。
$("input").click(function(){ $(this).closest('input').focus()})
document.documentElement
将成为您的 html 页面,并且您正在尝试将元素附加为 documentElement
的 innerHTML 的同级元素。
而不是 documentElement
使用 body
:
var text = document.createElement('input');
text.type = 'text';
document.body.appendChild(text);