Advertisement
n128

DOM | Prueba - cambiar texto

Jan 30th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4.     <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  5.     <title>Prueba DOM</title>
  6. </head>
  7. <body>
  8.     <p id="parrafo"> The value attribute is a DOMString that contains the current value of the text entered into the text field. You can retrieve this using the HTMLInputElement.value property in JavaScript. let theText = myTextInput.value;. </p>
  9.     <button onclick="cambiar();">Cambiar texto</button>
  10.  
  11.     <script>
  12.         var elementoP = document.getElementById("parrafo");
  13.         var cambio = "<b>Hola Mundo Cruel</b>";
  14.  
  15.         var cambiar = function() {
  16.             elementoP.innerHTML = cambio;
  17.             return elementoP;
  18.         }
  19.     </script>
  20. </body>
  21. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement