title: Jquery function won´t work after XMLHttpRequest
body: <p>I have a div (#div_eventos) that is updated via XMLHttpRequest to update data cointained in it. Also I have a function that executes on keyup in a input text field. This function do hide or show table rows when find coincidences on the search field (input text). But after the div_eventos is updated the function does not work anymore.</p>
  
  <p>Here is the function I want to execute even after div update:</p>
  
  <pre><code>$(document).on("keyup", "input#search", function(){
                      var filter = $(this).val();
                      var regExPattern = "gi";
                      var regEx = new RegExp(filter, regExPattern);
                      $("table tr").each(function () {
                          if($(this).data('state'))
                          if (
                          $(this).text().search(new RegExp(filter, "i")) &lt; 0
                          &amp;&amp; $(this).data('state').search(regEx) &lt; 0
                          ){
                              $(this).hide();
                          } else {
                              $(this).show();
                          }
                      });
                  });
  </code></pre>
  
  <p>Here is the div that is updated:</p>
  
  <pre><code>&lt;div id="div_eventos"&gt;                
              &lt;table class="estilo_original" width="100%"&gt;            
              &lt;tbody&gt;
              &lt;?php       
                  for($i=0; $i &lt; count($lecturas_sitios) ; $i++)
                  {
                      $cadena_lecturas="";
                      echo '&lt;tr data-state="california"&gt;';
                      echo '&lt;td&gt;';
                      echo ($i+1).". &lt;a href='presas.php?sitio=".$lecturas_id[$i]."&amp;tabla=".$lecturas_tabla[$i]."'&gt;".$lecturas_sitios[$i]."/".$lecturas_distrito[$i]." &lt;/a&gt; &lt;img src='images/".$lecturas_modo_comunicacion[$i]."' title='Modo de Comunicacion' width='24px' height='24px'&gt;";
                      echo '&lt;/td&gt;';
                      echo '&lt;td&gt;';
                      echo $lecturas_medidor_marca[$i]."-".$lecturas_medidor_modelo[$i]."&lt;/br&gt;".$lecturas_medidor_tipo[$i];
                      echo '&lt;/td&gt;';
                      echo '&lt;td&gt;';
                      echo $lecturas_flujo[$i];
                      echo '&lt;/td&gt;';
                      echo '&lt;td&gt;';
                      echo number_format($lecturas_volumen[$i]);
                      echo '&lt;/td&gt;';
  
                      echo '&lt;td&gt;';
                      if(strtolower($lecturas_medidor_marca[$i])=='panametrics')
                          echo "-";
                      else
                          echo $lecturas_nivel[$i];
                      echo '&lt;/td&gt;';
                      echo '&lt;td&gt;';
                      if($nivel == 1)
                          echo $lecturas_fecha[$i]." &amp;nbsp;&amp;nbsp; &lt;img src='images/".$lecturas_led[$i]."' title='".$lecturas_minutos_desconectado[$i]." horas desde última lectura' width='15px' height='15px'&gt;";
                      else
                          echo $lecturas_fecha[$i]." &amp;nbsp;";
                      echo '&lt;/td&gt;';
                      echo '&lt;/tr&gt;';
                  }
                  odbc_close($conn);
              ?&gt;
              &lt;/tbody&gt;
              &lt;/table&gt;
  </code></pre>
  
  <p>I've tried updating the event by delegating function (.on) but it still doesn't work. Can you please give me some advice?</p>
  
  <p>Thank yoou</p>