我有满足感的div如下所示.
<div style=" border:solid 1px #D31444" contenteditable="true">12 some text...</div>
Run Code Online (Sandbox Code Playgroud)
我需要的是,当我点击div时,所有文本将自动被选中.你能给我解决方案吗?
它有任何方法绑定execcommand与div元素而不是整个文档,我试试这个:
document.getElementById('div').execcommand(...)
Run Code Online (Sandbox Code Playgroud)
但它有一个错误:
execcommand is not a function
Run Code Online (Sandbox Code Playgroud)
它有任何方法绑定execcommand只有div元素而不是整个文件!! 我不喜欢使用iframe方法.