I am trying to use jQuery to change the display style of an element to none (the elements current display style is block).
I have the following HTML:
<div id="loginModal">
   <div id="modalContent">
      <h1>Welcome To Crunch</h1>
      <br/>
      <span id="codeValidator">Please Enter A Valid Code</span><br/>
      <input type="text" id="codeInput" placeholder="Enter Room Code" /><br/>
      <input type="text" id="usernameInput" placeholder="Enter Username" /><br/>
      <button id="joinRoom">Join Room</button>
   </div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="app.js"></script>
and the following Javascript in app.js:
$('#joinRoom').click(() => {
    $('#loginModal').style.display = 'none';
});
However whenever I click on the join room button I get the following error:
app.js:4 Uncaught TypeError: Cannot set property 'display' of undefined
Why is this happening and how can I fix it?
 
     
     
     
    