title: Disable button if space is entered input box using prop
body: <p>I have created a function which disables button if button is blank but I would like to disable it if input have only spaces. below is my code but I am unable to understand how can I add that into my jquery code.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="text" maxlength="200" style="margin-left: 0;" name="Name" id="Name" value="" /&gt;
  &lt;button type="add" name="btnadd" class="actionButton" disabled="disabled"&gt;
              &lt;span&gt;Add Name&lt;/span&gt;&lt;/button&gt;
  </code></pre>
  
  <p><strong>JS Script</strong></p>
  
  <pre><code>var validateName = function() {
  
           if ($('#Name').val() == '' || !$('#Name').val().trim().length){
  
              $('button.actionButton').prop('disabled', true);
            }
            else {
              $('button.actionButton').prop('disabled', false);
            }
  
      };
  
          $('#Name').keyup(function(e) {
  
              validateName();
          });
  
    $(document).ready(function(){
  
          validateName();
    });
  </code></pre>