title: Get the value of the input text field and substring it
body: <p>Please visit my fiddle 1st: <a href="http://jsfiddle.net/vHLXX/" rel="nofollow">http://jsfiddle.net/vHLXX/</a></p>
  
  <p>This is phone no. input field, if the length is 11 (value of the text input field) on click on the submit button alerts "yes" else "no".</p>
  
  <p>Now, I want if the 1st three string isn't 011 i want alert "invalid!"</p>
  
  <p>How can I get this (with jquery)?</p>
  
  <p>here is the html:</p>
  
  <pre><code>&lt;span&gt;enter you mobile no.&lt;/span&gt;
  &lt;input  maxlength="11" size="11" type="text" class="main-input" value=""/&gt;
  &lt;input type="button" class="Create" value="Submit"&gt;
  </code></pre>
  
  <p>and Jquery Code:</p>
  
  <pre><code>$('.main-input').on('keyup', function () {
      values = $(this).val();
      newValue = values.substring();
  }); 
  $('.Create').click(function () {   
      if (values.length === 11) {
          alert("yes");
      } else {
          alert("no");
      };
  });
  </code></pre>
  
  <p>PS: Could edit you my fiddle?</p>
  
  <p>Thank you.</p>