Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/02/2018, 23:19
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: evento sobre tabla dinamica

No se que o como lo estas haciendo porque no logro interpretar tu código, pero si lo que quieres es que alguna acción se ejecute una ves agregues lineas dinamicamente, debes invocarla con cada adición debido a que ese item no se encuentra en el dom en ese momento, Ejemplo:

La Clase
Código CSS:
Ver original
  1. .borde{
  2.         cursor:pointer;
  3.         border:solid;
  4.         border-width:2px;
  5.         border-color:#0000ff;
  6.         background-color:#595959;
  7.         color:#ffffff;
  8.     }

el html
Código HTML:
Ver original
  1. <button class="boton">AGREGAR</button>
  2. <table border="1">
  3.     <thead>
  4.         <th>Nombre</th>
  5.         <th>Apellido</th>
  6.         <th>Cedula</th>
  7.     </thead>
  8.     <tbody id="lista">
  9.     </tbody>

el js
Código Javascript:
Ver original
  1. $(function(){
  2.         $(".boton").click(function(){
  3.             $("#lista").append(`<tr>
  4.                 <td>Carlos</td>
  5.                 <td>Quintero</td>
  6.                 <td>Cedula</td>
  7.             </tr>`);
  8.             muestra();//aquí invoco a la función que va a monitorear mis celdas nuevas
  9.         })
  10.     })
  11.  
  12.     function muestra(){
  13.         $("#lista tr").hover(function(){
  14.             $(this).children('td').addClass('borde');
  15.         })
  16.         $("#lista tr").mouseleave(function(){
  17.             $(this).children('td').removeClass('borde');
  18.         })
  19.     }

VER MUESTRA
__________________
[email protected]
HITCEL