Node: selectstart イベント
selectstart
は選択 API のイベントで、新しい選択範囲をユーザーが指定した際に発行されます。
イベントがキャンセルされた場合、選択範囲は変更されません。
構文
このイベント名を addEventListener()
などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
js
addEventListener("selectstart", (event) => {});
onselectstart = (event) => {};
イベント型
一般的な Event
です。
例
js
// addEventListener バージョン
document.addEventListener("selectstart", () => {
console.log("選択が開始されました");
});
// onselectstart バージョン
document.onselectstart = () => {
console.log("選択が開始されました。");
};
仕様書
Specification |
---|
Selection API # selectstart-event |
Selection API # dom-globaleventhandlers-onselectstart |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selectstart event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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.