aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/element/select_event/index.html
blob: f0be06d15b5a47a425ba728ade836a8e5f3cd4ca (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: select
slug: Web/API/Element/select_event
translation_of: Web/API/Element/select_event
---
<p>L'évènement <code>select</code> est déclenché quand du texte est sélectionné. L'évènement peut ne pas être disponible pour tous les éléments dans tous les langages. Par exemple, en <a href="http://www.w3.org/TR/DOM-Level-3-Events/#references-HTML5">HTML5</a>, les évènements select ne peuvent être envoyés que sur des éléments <code>input</code> de formulaire et <code>textarea</code>.</p>

<h2 id="Info_générale">Info générale</h2>

<dl>
 <dt>Spécification</dt>
 <dd><a href="http://www.w3.org/TR/DOM-Level-3-Events/#event-type-select">DOM L3</a></dd>
 <dt>Interface</dt>
 <dd>UIEvent si généré depuis une interface utilisateur, Event sinon.</dd>
 <dt>Remonte</dt>
 <dd>Oui</dd>
 <dt>Annulable</dt>
 <dd>Non</dd>
 <dt>Cible</dt>
 <dd>Élément</dd>
 <dt>Action par Défault</dt>
 <dd>Aucune</dd>
</dl>

<h2 id="Propriétés">Propriétés</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Property</th>
   <th scope="col">Type</th>
   <th scope="col">Description</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>target</code> {{readonlyInline}}</td>
   <td><a href="/en-US/docs/Web/API/EventTarget"><code>EventTarget</code></a></td>
   <td>The event target (the topmost target in the DOM tree).</td>
  </tr>
  <tr>
   <td><code>type</code> {{readonlyInline}}</td>
   <td><a href="/en-US/docs/Web/API/DOMString"><code>DOMString</code></a></td>
   <td>The type of event.</td>
  </tr>
  <tr>
   <td><code>bubbles</code> {{readonlyInline}}</td>
   <td><a href="/en-US/docs/Web/API/Boolean"><code>Boolean</code></a></td>
   <td>Whether the event normally bubbles or not.</td>
  </tr>
  <tr>
   <td><code>cancelable</code> {{readonlyInline}}</td>
   <td><a href="/en-US/docs/Web/API/Boolean"><code>Boolean</code></a></td>
   <td>Whether the event is cancellable or not.</td>
  </tr>
  <tr>
   <td><code>view</code> {{readonlyInline}}</td>
   <td><a href="/en-US/docs/Web/API/WindowProxy" rel="nofollow"><code>WindowProxy</code></a></td>
   <td><a href="/en-US/docs/Web/API/Document/defaultView"><code>document.defaultView</code></a> (<code>window</code> of the document)</td>
  </tr>
  <tr>
   <td><code>detail</code> {{readonlyInline}}</td>
   <td><code>long</code> (<code>float</code>)</td>
   <td>0.</td>
  </tr>
 </tbody>
</table>

<h2 id="Example">Exemple</h2>

<pre class="brush: html">&lt;input id="test" type="text" value="Sélectionnez-moi !" /&gt;
&lt;script&gt;
  var elem = document.getElementById('test');
  elem.addEventListener('select', function() {
    alert('La sélection a changé !');
  }, false);
&lt;/script&gt;</pre>