Move you counter logic into a function and execute it on each click.
You are writing many times "trackEl.innerHTML = 'something';", what about making a function that accepts a string as param and paints it into 'trackEl'?
HTML
Add form
Use a label to define the content of the input.
Connect the label to the input using the for attribute of the label and the id of the input.
Use placeholder.
Steps to finish the game (for those far from the solution)
You are close to the exercise solution, but here you have a steps guide to complete it anyway ;)
Save a reference to DOM elements in variables.
Generate the random number and save it to a variable.
Init counter of trials to 0.
Define a function that executes when the user clicks on the button, that
increments the counter and paints its value in the HTML.
collect the value of the HTML input and compare it with the random number.
if they are equal, draw a 'You Win' message.
if it's lower, draw a 'Too short' message.
if it's higher, draw a 'Too long' message.
Assign a listener to the button click to execute the previous function.
Further challenges
Then you can improve the game as you please, here you have some ideas:
Add new feedback when the number is bigger than 100 or smaller than 0.
Manage when the user hits the button and the input is empty.
Make the input work when hitting enter key.
Add a reset button that cleans the input, the counter, writes the initial feedback and generates a new random number to play again!
Whatever you want!
Call to action
Let me know if you have any doubts ;)
Go for it!!
Do not close this issue until your teacher asks you to