[英]How to select text of the two elements with contentEditable = true?
I would like to ask, how can I select text of the two HTML elements, which property contentEditable is set to true. 我想问一下,如何选择两个HTML元素的文本,其contentEditable属性设置为true。 When I start to select text with mouse in one element, the selection ends within it's range. 当我开始用鼠标在一个元素中选择文本时,选择将在其范围内结束。 Never reach the second element. 永远不要到达第二个元素。
I tried to apply also "user-select" property, but without effect. 我尝试也应用“用户选择”属性,但没有效果。
here is snippet. 这是片段。
<body>
<div contentEditable = true style="position:absolute; left: 10px; top:10px; width:100px; height:200px; border: 3px solid #73AD21;">
Donec tempus, nisi a pharetra placerat, diam nisi aliquam elit, a consectetur magna enim sed ligula.
</div>
<div contentEditable = true style="position:absolute; left: 130px; top:10px; width:100px; height:200px; border: 3px solid #73AD21;">
The oldest browsers support only one way of registering event handlers, the way invented by Netscape.
</div>
</body>
thanx a lot 非常感谢
You can wrap these <div>
s inside another <div>
and make it contentEditable="true"
instead of these two. 您可以将这些<div>
包裹在另一个<div>
并使其成为contentEditable="true"
而不是这两个。
<body>
<div contentEditable="true">
<div style="position:absolute; left: 10px; top:10px; width:100px; height:200px; border: 3px solid #73AD21;">
Donec tempus, nisi a pharetra placerat, diam nisi aliquam elit, a consectetur magna enim sed ligula.</div>
<div style="position:absolute; left: 130px; top:10px; width:100px; height:200px; border: 3px solid #73AD21;">
The oldest browsers support only one way of registering event handlers, the way invented by Netscape.</div>
</div>
</body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.