在IE的contenteditable div中的输入框中插入文本 [英] Insert text in input box in contenteditable div in IE

查看:103
本文介绍了在IE的contenteditable div中的输入框中插入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 contenteditable div的输入框中插入文本。当我单击输入框时,光标不会出现。双击输入框后可以插入文本。

I am trying to insert text in input box which is in contenteditable div. When I click on input box, the cursor does not appear. I can insert text after double click on input box. This problem occurs in IE.

<div contenteditable="true">
   <input type="text">
</div>

https://jsfiddle.net/spgkpgdy/

谢谢。

推荐答案

您好,您可以尝试像这样的希望对您有用的

Hello you could try something like this hope it works for you

function controlselectHandler(evt) {
    evt.preventDefault();
}
document.body.addEventListener('mscontrolselect', controlselectHandler);



$('#abc').on('click','input[type="text"]',function(e){
    $(this).focus();  
})

我对

修改后的演示: https://jsfiddle.net/spgkpgdy/9/

引用链接:https://stackoverflow.com/a/21875990/2260060

这篇关于在IE的contenteditable div中的输入框中插入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆