title: jQuery: too much recursion on .focus()
body: <p>I am using the jQuery <code>.focus()</code> method to focus on an element through a remote script in asp.net. I am getting an error about too much recursion.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>asp.net code : </p>
  
  <pre><code>Response.Write("&lt;script&gt;$('#ledger_name').focus();&lt;/script&gt;");
  </code></pre>
  
  <p>html </p>
  
  <pre><code>&lt;input type="text" id="account_name" name="account_name" /&gt;
  </code></pre>
  
  <p>js for auto complete </p>
  
  <pre><code>$("#account_name").autocomplete({
      source: account_master,
      minLength: 1,
      minChars: 0,
      width: 350,
      mustMatch: 0,
      selectFirst: true,
      matchContains: false,
      autoFocus: true,
      autoFill: false,
      change: function (event, ui) {
          if (!ui.item) {
              $(this).val('');
          }
      },
      select: function (event, ui) {
          $("#account_name").val(ui.item.label);
          $("#account_name_code").val(ui.item.id);
          $("#account_name_parent").val(ui.item.parent);
  
          //$('#ledger_name').focus();
          return true;
      }
  
  });
  </code></pre>
  
  <p>jquery ui</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>it's giving an error in jquery-ui.min.js file on calling  <code>$('#ledger_name').focus();</code> in autocomplete</p>