aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/selection/tostring/index.html
blob: 3048c8a65f1df9fef995c6f5fd8f7777f37d8df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: Selection.toString()
slug: Web/API/Selection/toString
translation_of: Web/API/Selection/toString
---
<div>
<div>
<div>{{ ApiRef("DOM") }}{{SeeCompatTable}}</div>
</div>
</div>

<p><strong><code>Selection.toString()</code></strong> 메소드는 selection 객체가 현재 나타내는 문자열을 반환합니다. 즉, 현재 선택된 텍스트의 문자열.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox"><em>str</em> =<em> sel</em>.toString()
</pre>

<h3 id="Return_value">Return value</h3>

<p>A string representing the selection.</p>

<h2 id="Description" name="Description">Description</h2>

<p>This method returns the currently selected text.</p>

<p>In <a href="en/JavaScript">JavaScript</a>, this method is called automatically when a function the selection object is passed to requires a string:</p>

<pre class="brush: js">alert(window.getSelection()) // What is called
alert(window.getSelection().toString())  // What is actually being effectively called.
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML Editing', '#dom-selection-stringifier', 'Selection.toString()')}}</td>
   <td>{{Spec2('HTML Editing')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>

<div>{{Compat("api.Selection.toString")}}</div>

<h2 id="See_also" name="See_also">See also</h2>

<ul>
 <li>{{domxref("Selection")}}, the interface it belongs to.</li>
</ul>