Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/06/2015, 11:39
PHPeros
Colaborador
 
Fecha de Ingreso: septiembre-2013
Ubicación: España
Mensajes: 3.648
Antigüedad: 10 años, 8 meses
Puntos: 578
Respuesta: ¿Cuando hay un cambio en input type="file" cómo modificar otro elemento?

Tenías los identificadores mal.

Código HTML:
Ver original
  1. <input type="file" id="file" name="file">
  2. <div id="etc-1" class="etc-1">
  3. <p id="etc-txt">Hola</p>
  4. </div>

Código Javascript:
Ver original
  1. $(document).ready(function(){
  2.     $("#file").change(function(){
  3.         if ($("#etc-txt").text() == "Hola" ){
  4.             $("#etc-txt").text("Gracias");
  5.         }else{
  6.             $("#etc-txt").text("Hola");
  7.         }
  8.     });
  9. });