title: jquery if input text has value, add class to label, remove it if no value
body: <p>I'm sure there are many similar questions here but still i can't find an answer to this. What i want is to add a class to the label on document ready if the input[type="text"] has a value and remove that class if the user will delete that input value ( better said, remove the label class if the input has no value on blur ).</p>
  
  <p>Code so far:</p>
  
  <pre><code>    &lt;div class="input-wrap"&gt;            
                  &lt;input type="text" name="textdemo" id="textdemo" size="20" value="" class="textdemo" /&gt;
              &lt;label class="demo-label" for="textdemo"&gt;{L_USERNAME}&lt;/label&gt;
      &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  jQuery(document).ready(function(){
      $('.input-wrap .textdemo').val() ) {
            $('label.demo-label').addClass('input-has-value');
      }
  
  });
  &lt;/script&gt;
  </code></pre>