title: How to add a prefix "91" to a textbox using Jquery or HTML
body: <p>I am new to jquery, i have a form. In that i am trying to add prefix <code>91</code> to mobile number field. I tried so many ways but not working.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#mobile').keyup(function() {
    var oldvalue = $(this).val();
    var field = this;
    setTimeout(function() {
      if (field.value.indexOf('91') !== 0) {
        $(field).val(oldvalue);
      }
    }, 1);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;form class="form-horizontal" role="form"&gt;
    &lt;div class="col-md-6"&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="ifsc" class="col-lg-4 control-label"&gt;&lt;span class="mandatory"&gt;&lt;/span&gt; IFSC &lt;/label&gt;
        &lt;div class="col-lg-6"&gt;
          &lt;input type="text" class="form-control" id="ifsc" name="ifsc" maxlength="8" placeholder="Enter ifsc" /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label class="col-md-4 control-label"&gt;&lt;span class="mandatory"&gt;&lt;/span&gt; Accounts&lt;/label&gt;
        &lt;div class="col-md-6"&gt;
          &lt;input type="text" name="account" id="account" class="form-control" placeholder="Enter Account No" /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group "&gt;
        &lt;label for="mobile" class="col-lg-4 control-label"&gt;&lt;span class="mandatory"&gt;&lt;/span&gt; MOBILE NO&lt;/label&gt;
        &lt;div class="col-lg-6"&gt;
          &lt;input type="text" class="form-control" id="mobile" data-minlength="10" maxlength="10" placeholder="Enter Contact Number" /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What is wrong in my code?</p>