title: Selector, Event Handling and Keydown event - doesnt work together
body: <p>Im trying to create a chat box, where, when i input a text and hit enter message is sent and when i press shift+Enter a new line is created.</p>
  
  <p>However, for some reason Keydown event is not getting picked up.
  Im not sure if its a code problem or a browser problem or something else.</p>
  
  <p><strong>chat.js</strong></p>
  
  <pre><code>var chat = {}
  
  chat.throwmsg = function(message) {
  if ($.trim(message).length != 0) {
      console.log = 1;
  }
  }
  
  chat.entry = $('.chat .entry');
  chat.entry.bind("keydown", function(e) {
  //alert("1");
  if (e.keyCode === 13 &amp;&amp; e.shiftKey === false) {
      //chat.throwmsg($(this).val());
      e.preventDefault();
  }
  });
  </code></pre>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;AJAX chat&lt;/title&gt;
      &lt;link rel="stylesheet" href="css/style.css"&gt;
      &lt;script src="js/jquery-3.3.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/chat.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="chat"&gt;
          &lt;div class="messages"&gt;          
          &lt;/div&gt;
          &lt;textarea class="entry"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Please help! Thanks in advance :)</p>