title: Form validation onkeyup
body: <p>I am using this code to send value when user hits enter. What I want is if user hits enter without entering any value, he gets an error</p>
  
  <pre><code>&lt;textarea class="auto-grow-input" onfocus="SK_focusChat();" onkeyup="SK_sendChatMessage(this.value,&lt;?php echo $sk['chat']['recipient']['id']; ?&gt;,event);"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>// Send chat message</p>
  
  <pre><code>function SK_sendChatMessage(text,recipient_id,e) {
      document.title = document_title;
      textarea_wrapper = $('.chat-textarea');
      chat_messages_wrapper = $('.chat-messages');
  
      if (e.keyCode == 13 &amp;&amp; e.shiftKey == 0) {
          e.preventDefault();
          textarea_wrapper.find('textarea').val('');
          chat_messages_wrapper.append('&lt;div class="chat-text align-right temp-text" align="right"&gt;&lt;div class="text-wrapper float-right"&gt;' + text + '&lt;div class="marker-out"&gt;&lt;div class="marker-in"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="float-clear"&gt;&lt;/div&gt;&lt;/div&gt;');
  
          $.post(SK_source() + '?t=chat&amp;a=send_message', {text: text, recipient_id: recipient_id}, function (data) {
              chat_messages_wrapper
                  .append(data.html)
                  .scrollTop(chat_messages_wrapper.prop('scrollHeight'))
                  .find('.temp-text')
                      .remove();
          });
      }
  }
  </code></pre>