JS HTML null вместо ввода

Решение
потому что значение инпута храниться в поле value
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="text" id="usernameInput">
  <button onclick="register()">погнали</button>
  <p id="output"></p>
  <script>
    function register() {
      const output = document.querySelector('#output');
      const input = document.querySelector('#usernameInput');
      output.textContent = `всем привет, usernameInput.value = ${input.value}`
    }
  </script>
</body>
</html>
1689233174085.png

neverlane

t.me/neverlane00
Друг
997
1,132
потому что значение инпута храниться в поле value
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="text" id="usernameInput">
  <button onclick="register()">погнали</button>
  <p id="output"></p>
  <script>
    function register() {
      const output = document.querySelector('#output');
      const input = document.querySelector('#usernameInput');
      output.textContent = `всем привет, usernameInput.value = ${input.value}`
    }
  </script>
</body>
</html>
1689233174085.png