Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/11/2008, 11:23
Trypat
 
Fecha de Ingreso: febrero-2008
Mensajes: 38
Antigüedad: 16 años, 2 meses
Puntos: 0
jquery y disabled

Pego el siguiente código, tiene que ser una chorrada pero llevo rato mirándolo y no se donde he metido la pata hasta dentro.
Al ocurrir el evento onchange del segundo input no me habilita el primer input, aunque si le doy al botón si que lo habitilita.

Código:
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
 <script>
   $(document).ready(function(){ 
    $("button").click(function () {
      $(this).next().removeAttr("disabled")
             .focus()
             .val("editable");
    });
  });
  function pruebra(){
		$('#cambio').removeAttr("disabled");
	}


  </script>
  
</head>
<body>

<button>Habilitar</button>
<input type="text" disabled="disabled" id="cambio" value="no se puede editar" />
<input type="text" id="prueba1" onchange="prueba()" />
<input type="text" id="prueba2"  />

</body></html>