title: JQuery if input starts with a value
body: <p>I am managing to check the value inside a postcode input field using the following:</p>
  
  <p>html:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type="text" class="cart-postcode2" size="10" tabindex="22"&gt;
  </code></pre>
  
  <p>JQuery:</p>
  
  <pre class="lang-js prettyprint-override"><code>$('.cart-postcode2').keyup(function(){
      var value = $(this).val();
      if (value.indexOf('BT') &gt;= 0) {
          alert("is ireland");
      }
  })
  </code></pre>
  
  <p>This is working great however I want it to only alert if it starts with BT and does not contain BT in any part of the value, does anyone know if this is possible?</p>
  
  <p>So typing <code>BT2 9NH</code> will alert "Ireland" but typing <code>OX2 8BT</code> will not</p>