Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/11/2012, 18:40
Avatar de djaevi
djaevi
 
Fecha de Ingreso: marzo-2007
Ubicación: Moreno, Buenos Aires
Mensajes: 400
Antigüedad: 17 años, 1 mes
Puntos: 47
Respuesta: Problema funcion next()

Te estas equivocando al interpretar el arbol DOM mira:

Código HTML:
Ver original
  1.     <tr>
  2.         <td>
  3.             <input class="services" type="text" name="s5" id="s5" />
  4.         </td>
  5.         <td>
  6.             <input class="tiempos" type="text" name="t5" id="t5" />
  7.         </td>
  8.         <td>
  9.             <input class="services" type="text" name="s6" id="s6" />
  10.         </td>
  11.         <td>
  12.             <input class="tiempos" type="text" name="t6" id="t6" />
  13.         </td>
  14.         <td>
  15.             <input class="services" type="text" name="s7" id="s7" />
  16.         </td>
  17.         <td>
  18.             <input class="tiempos" type="text" name="t7" id="t7" />
  19.         </td>
  20.     </tr>

Como veras los input no son "hermanos" sino que cada uno esta dentro de un TD por ende no puedes llamarlos con next() ya que cada input es el unico nodo dentro del TD.

Para moverte por los inputs deberias salir a su nodo padre y de ahi si pasar al proximo elemento td y ahi acceder a su hijo input x ej:

Código Javascript:
Ver original
  1. $('.services').blur(function() {
  2.     if ($(this).val ( ) == "" ) {
  3.         $(this).parent().next().children(".tiempos").hide();
  4.     }
  5. });

Prueba aver si funciona. Salu2!