【发布时间】:2020-11-05 15:34:46
【问题描述】:
在 textarea 中侦听 selectionchange 事件在 chrome 和 safari 中有效,但在 Firefox 中无效。
<div>selecting me will detect your selecting!</div>
<textarea>alas, I will not!</textarea>
<div id="f"></div>
document.addEventListener( 'selectionchange', function() {
document.getElementById('f').innerHTML += '<br>selecting';
});
我应该监听什么事件?
演示
【问题讨论】:
-
它适用于我的 Firefox 95。
-
@Friedrich 是的,看来这已经解决了
标签: javascript html firefox textselection