title: How To Disable Return In Input But Allow Enter Event Key To Be Used To Send Message
body: <p>I added a code to my chat system, which allows the enter key to send the message, instead of the user pressing the send button manually.</p>
  <p>But, in the input chat box, once the enter button is pressed, the chat box still reads it as a &quot;return&quot; which puts an unnecessary empty bottom line before sending.</p>
  <p><strong>see example</strong><br />
  <img src="https://i.stack.imgur.com/QjJSS.png" alt="see example" /></p>
  <p>How can I disable the input from reading it as &quot;return&quot; but still allow the enter event key to allow the sending of the message?</p>
  <p>Here's the code I have</p>
  <pre><code>&lt;script&gt;
      jQuery('document').ready(function($) {
  
          $('body').on('click', '.um-bottom-header', function() {
              $('.um-bottom-body').toggleClass('close');
              $('.um-bottom-header .icons').toggleClass('open');
          });
  
          $('body').on('click', '.um-personal-chat-icons .far', function() {
              $(this).parents('.um-message-modal').toggleClass('close')
              // $(this).parent().toggleClass('open');
          });
  
          $('body').on('click', '.um-message-modal.close', function() {
              $(this).removeClass('close');
          });
          // function submitName(e) {
          //   if (e.code === 'Enter') {
          //     document.getElementById('send-btn').click();
          //   }
          // }
          $('body').on('keyup', '#um_message_text', function(event) {
              event.preventDefault();
              if (event.keyCode === 13) {
                  $(&quot;.um-message-send&quot;).click();
              }
          });
      })
  &lt;/script&gt;
  </code></pre>
  <p>It's the code towards the bottom, I just wanted to include the script section.</p>