aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/document/createtextnode/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/es/web/api/document/createtextnode/index.html
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/es/web/api/document/createtextnode/index.html')
-rw-r--r--files/es/web/api/document/createtextnode/index.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/files/es/web/api/document/createtextnode/index.html b/files/es/web/api/document/createtextnode/index.html
new file mode 100644
index 0000000000..fc1b1488f4
--- /dev/null
+++ b/files/es/web/api/document/createtextnode/index.html
@@ -0,0 +1,78 @@
+---
+title: Document.createTextNode()
+slug: Web/API/Document/createTextNode
+tags:
+ - API
+ - DOM
+ - Documento
+ - Referencia
+ - createTextNode
+ - metodo
+translation_of: Web/API/Document/createTextNode
+---
+<div>{{APIRef("DOM")}}</div>
+
+<p>Crea un nuevo nodo de texto. Este método puede ser usado para escapar caracteres HTML.</p>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox">var <var>text</var> = document.createTextNode(<var>data</var>);
+</pre>
+
+<ul>
+ <li><var>text</var> es un nodo Text.</li>
+ <li><var>data</var> es una cadena de texto <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> que contiene los datos a poner en el nodo de texto.</li>
+</ul>
+
+<h2 id="Ejemplo">Ejemplo</h2>
+
+<pre class="brush: html">&lt;!DOCTYPE html&gt;
+&lt;html lang="en"&gt;
+&lt;head&gt;
+&lt;title&gt;createTextNode example&lt;/title&gt;
+&lt;script&gt;
+function addTextNode(text) {
+ var newtext = document.createTextNode(text),
+ p1 = document.getElementById("p1");
+
+ p1.appendChild(newtext);
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+ &lt;button onclick="addTextNode('YES! ');"&gt;YES!&lt;/button&gt;
+ &lt;button onclick="addTextNode('NO! ');"&gt;NO!&lt;/button&gt;
+ &lt;button onclick="addTextNode('WE CAN! ');"&gt;WE CAN!&lt;/button&gt;
+
+ &lt;hr /&gt;
+
+ &lt;p id="p1"&gt;First line of paragraph.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Especificación</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentario</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-document-createtextnode', 'Document: createTextNode')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_con_navegadores">Compatibilidad con navegadores</h2>
+
+
+
+<p>{{Compat("api.Document.createTextNode")}}</p>