Ver Mensaje Individual
  #6 (permalink)  
Antiguo 12/11/2010, 09:50
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: problema con append jquery

efectivamente como dijo chichohot, tenes 2 tbody, aunque no lo veas en tu código

en el código tenes solo 1
Código HTML:
Ver original 

pero tenes un tr suelto, ahi se genera un tbody

entonces te queda 2 tbody, fijate en el firebug la estructura y vas a entender


arregle tu tabla te debe quedar algo asi

Código HTML:
Ver original
  1.     <head>
  2.         <title>Ejemplo</title>
  3.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  4.     </head>
  5.         <script type="text/javascript">
  6.         $( function (){
  7.             var num = 0;
  8.             $("#agrega").click(fn_agregar)
  9.             function fn_agregar(){
  10.                 num++;
  11.  
  12.                 cadena = "<tr>";
  13.                 cadena += "<td>" + num + "</td>";
  14.  
  15.                 $("#tabla tbody").append(cadena);
  16.  
  17.                 alert("Recorrido Agregado"+ num);
  18.             };
  19.         });
  20.  
  21.         </script>
  22.     <style>
  23.     </style>
  24.     <body>
  25.  <div id="controles">
  26.     <table width="1024" border="1" cellpadding="0" cellspacing="0" id="tabla" align="center" style="border-collapse:collapse">
  27.         <thead>
  28.             <tr>
  29.                 <th align="center" width="10%">ID</th>
  30.                 <th width="5%">agrega</th>
  31.             </tr>
  32.         </thead>
  33.  
  34.         <tbody>
  35.         <tr>
  36.             <td align="center"></td>
  37.             <td align="center"><input type="button" name="agrega" id="agrega" value="agrega" /></td>
  38.         </tr>
  39.         </tbody>
  40.     </table>
  41. </div>
  42. </html>