title: Losing focus on HTML elements retrieved by AJAX calls
body: <p>I'm having problems with losing focus on the page when returning HTML using AJAX calls with jQuery. This results in two clicks being required to use any of the injected links. Using .focus() on the returned elements doesn't appear to have an effect. I solved a similar problem previously (that resulted in buttons needing to be clicked twice) by using prependTo but this doesn't seem to work in this instance. Any help would be greatly appreciated.</p>
  
  <p>Cheers.   </p>
  
  <pre><code> $('input#5000').click(function(){
                 //Run SQL query
              $
  
              $.ajax({    
                  type:    'POST',    
                  url:     '/querytorun/',   
                  data:    'querytorun='+$('p#3000').html(), 
                  //Either display error message or results
                  error:   function(){ $('p#4000').html("Can't run SQL query"); },    
                  success: function(data) { 
                      $('p#4000').html(data); 
                      $('div').remove('.qbb');
                      $('&lt;div class = qbb&gt;&lt;input id="email_btn" type="button" onClick="window.location=\'email_form_list/\'" value="Email Users" /&gt;&lt;/div&gt;').prependTo('#export_query_wrapper');
                      $('&lt;div class = qbb&gt;&lt;input id="csv_btn" type="button" onClick="window.location=\'csv_export/\'" value="Export CSV" /&gt;&lt;/div&gt;').prependTo('#export_query_wrapper');
                  }    
              });               
                  return false;
              }); 
  </code></pre>