[chaiscript] Help

Viewer

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Change text with JavaScript</title>
  8. </head>
  9. <body>
  10.     <h1 id="change-text">Change text with JavaScript</h1>
  11.     <script src="main.js"></script>
  12.     <button onclick="changeText()">Change text</button>
  13.     <input type="text" placeholder="Enter text" id="text-input">
  14. </body>
  15. </html>
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. const mainText = document.getElementById('change-text')
  33. const input = document.getElementById('text-input')
  34.  
  35. var value = input.value;
  36. console.log(value)
  37.  
  38. function changeText() {
  39.     console.log(value)
  40.     mainText.innerHTML = value[0];
  41.     console.log("Text changed to " + value)
  42. };

Editor

You can edit this paste and save as new:


File Description
  • Help
  • Paste Code
  • 24 Jan-2022
  • 832 Bytes
You can Share it: