aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/html/element/input/checkbox/index.html
blob: 20ef89a40cf104be1584d3b882a9219bfc0a8a69 (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
---
title: <input type="checkbox">
slug: Web/HTML/Element/input/checkbox
translation_of: Web/HTML/Element/input/checkbox
original_slug: Web/HTML/Elemento/input/checkbox
---
<p><span class="seoSummary">El elemento HTML <strong><code>&lt;input type="checkbox"&gt;</code></strong> es un elemento de entrada que te permite insertar un vector o array de valores. El atributo <strong>value</strong> es usado para definr el valor enviado por el <strong>checkbox</strong>. El atributo <strong>checked</strong> se usa para indicar que el elemento está seleccionado. El atributo <strong>indeterminate</strong> se usa para indicar que el <strong>checkbox</strong> esta en un estado indeterminado (en la mayoria de las plataformas, esto dibuja una linea horizontal que atraviesa el <strong>checkbox</strong>).</span></p>

<h2 id="Atributos">Atributos</h2>

<p>Este elemento posee los "<a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes">atributos globales</a>".</p>

<dl>
 <dt>{{htmlattrdef("checked")}}</dt>
 <dd>
 <p>Cuando el valor del atributo <strong>type</strong> es <strong><code>checkbox</code></strong>, la presencia de este atributo booleano indica que el control se selecciona de forma predeterminada; de lo contrario, se ignora.</p>
 </dd>
 <dt>{{htmlattrdef("value")}}</dt>
 <dd>El valor inicial de control. Si se omite la propiedad <strong>value</strong>, el resultado<strong> </strong>devuelto al leer esta propiedad será la cadena <strong>on.</strong></dd>
 <dd>Tenga en cuenta que al volver a cargar la pagina, Gecko y IE  <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=46845#c186">ignorarán el valor especificado en el  código HTML</a>, si el valor se cambió antes de la recarga.</dd>
 <dt>{{htmlattrdef("indeterminate")}}</dt>
 <dd>Indica que la casilla de verificación está en un estado indeterminado (en la mayoría de las plataformas, dibuja una línea horizontal a través del checkbox).</dd>
</dl>

<h2 id="Ejemplo">Ejemplo</h2>

<pre class="brush: html">&lt;label&gt;&lt;input type="checkbox" id="cbox1" value="first_checkbox"&gt; Este es mi primer checkbox&lt;/label&gt;&lt;br&gt;

&lt;input type="checkbox" id="cbox2" value="second_checkbox"&gt; &lt;label for="cbox2"&gt;Este es mi segundo checkbox&lt;/label&gt;
</pre>

<p>Esto crea dos casillas de verificación, que se ven así:</p>

<p>{{EmbedLiveSample("Ejemplo")}}</p>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <td>Especificación</td>
   <td>Estatus</td>
  </tr>
  <tr>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'forms.html#checkbox-state-(type=checkbox)', '&lt;checkbox&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'forms.html#checkbox-state-(type=checkbox)', '&lt;checkbox&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'interact/forms.html#checkbox', '&lt;checkbox&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidad_en_navegadores">Compatibilidad en navegadores</h2>

{{Compat("html.elements.input.input-checkbox")}}