I am learning jQuery/js and working on the 'hot or cold' exercise that appears to be a popular starting point.
However when submitting the user's input, .click() appears to cause Math.random to generate a new number, thus creating a new number each time the user submits a guess. The desired outcome is that the generated number remains the same.
From what I can tell, my code LOOKS correct. Could someone explain my error?
HTML
<title>Untitled Document</title>
</head>
<body>
<button>
      play?
   </button>
<div class="show">
    </div>
   <form>
    <input type="text" name="inputform" id="textbox" 
    autocomplete="off" value="">
    <input type="submit" id="txtbutton" class="txtbutton" value="Submit">
   </form>
  <div class="showMore">
  </div>
</body>
</html>
JS
$(document).ready(function(){
    var randomNum = Math.floor((Math.random()*100)+1);
    $('div').text(randomNum);
    var ui = $('#textbox');
    $('.txtbutton').click(function(){
        var clearGuess = function() {
            $("#userGuess").val("").focus();
        };
        var x = ui.val();
    });
});
 
    