GlobalEventHandlers.onselectionchange
GlobalEventHandlers.onselectionchange
属性表示当一个 selectstart
事件被触发,比如在页面上选中文字变化时,会执行绑定的事件处理器
语法
obj.onselectionchange = function;
示例
js
var selection;
document.onselectionchange = function () {
console.log("New selection made");
selection = document.getSelection();
};
完整例子请参阅Key quote generator demo.
规范
Specification |
---|
Selection API # selectionchange-event |
Selection API # dom-globaleventhandlers-onselectionchange |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selectionchange event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.