From ba5d6f9610d6bb352eecfa3ded1bb99bc9892916 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 11 Dec 2020 19:00:14 -0500 Subject: dump 2020-12-11 --- files/ko/web/api/element/select_event/index.html | 76 ++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 files/ko/web/api/element/select_event/index.html (limited to 'files/ko/web/api/element') diff --git a/files/ko/web/api/element/select_event/index.html b/files/ko/web/api/element/select_event/index.html new file mode 100644 index 0000000000..87dd62fa4a --- /dev/null +++ b/files/ko/web/api/element/select_event/index.html @@ -0,0 +1,76 @@ +--- +title: 'Element: select event' +slug: Web/API/Element/select_event +translation_of: Web/API/Element/select_event +--- +
{{APIRef}}
+ +

select 이벤트는 어떤 텍스트가 선택되었을 때 발생됩니다.

+ + + + + + + + + + + + + + + + + + + + +
BubblesYes
CancelableNo
Interface유저 인터페이스로부터 발생된 경우 {{domxref("UIEvent")}}, 아니라면 {{domxref("Event")}}
Event handler property{{domxref("GlobalEventHandlers.onselect", "onselect")}}
+ +

The event is not available for all elements in all languages. For example, in HTML, select events can be dispatched only on form {{HtmlElement('input/text', '<input type="text">')}} and {{HtmlElement("textarea")}} elements.

+ +

Examples

+ +

Selection logger

+ +
<input value="Try selecting some text in this element.">
+<p id="log"></p>
+ +
function logSelection(event) {
+  const log = document.getElementById('log');
+  const selection = event.target.value.substring(event.target.selectionStart, event.target.selectionEnd);
+  log.textContent = `You selected: ${selection}`;
+}
+
+const input = document.querySelector('input');
+input.addEventListener('select', logSelection);
+ +

{{EmbedLiveSample("Selection_logger")}}

+ +

onselect equivalent

+ +

You can also set up the event handler using the {{domxref("GlobalEventHandlers.onselect", "onselect")}} property:

+ +
input.onselect = logSelection;
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatus
{{SpecName('UI Events', '#event-type-select', 'select')}}{{Spec2('UI Events')}}
+ +

Browser compatibility

+ +

{{Compat("api.Element.select_event")}}

-- cgit v1.2.3-54-g00ecf