I'm stuck on a problem. I'm working on an exercise that generates a random integer between 1-10. The user will submit a number from 1-10 in the input box. If a match occurs, the user will get an alert notifying them of success.
I'm stuck on getting the number from the user input. I want to log to the console the form input, but for the life of me, I cannot figure this out. I've tried changing the form type="number", type="text" and tried using parseInt().
Anything glaring in my code?
function exerciseEight() {
  let input = document.querySelector("#number").value;
  let button = document.querySelector("#guess");
  let valueInt = parseInt(input, 10);
  let number = Math.ceil(Math.random() * 10);
  console.log(number);
  button.onclick = function() {
    console.log(input);
  };
}
exerciseEight();<body>
  <div class="container container-fluid">
    <p><strong>Exercise Eight:</strong> Guess a Number between 1 and 10.</p>
    <form>
      <div class="form-group">
        <label for="number">Choose Number:</label>
        <input id="number" value="" type="text" name="number" />
    </form>
    <!-- Result will go here -->
    <p id="result"></p>
    </div>
    <button class="btn btn-dark" id="guess" type="submit">SUBMIT</button>
</body> 
     
    