Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/04/2011, 08:29
erdnase90
 
Fecha de Ingreso: abril-2011
Mensajes: 2
Antigüedad: 13 años
Puntos: 0
Problema con jQuery y click()

Hola a todos,

Estoy empezando con jQuery, y tengo un problema con la función click. Si pongo el script embebido en el html funciona sin problemas, pero si lo pongo en un archivo aparte no va.

Seguramente sea un fallo de lo más tonto, pero después de comprobarlo en varios navegadores y buscar en google sigo sin dar con el fallo.

Código:
<!DOCTYPE HTML>
<html>
	<head>
		<script src="http://code.jquery.com/jquery-1.5.js"></script>
		<script src="script.js"></script>
		<title>Prueba</title>
	</head>
	<body>
		<div>
			<p id="other">Parrafo</p>
			<button id="hide">Ocultar</button>
			<button id="red">Rojo</button>
		</div>
		<!--<script>
			$('#hide').click(function(){
				$('#other').hide('slow');
			});
			$('#red').click(function(){
				$('#other').css('color','red');
			});
		</script>-->
	</body>
</html>
<!--
	Codigo de script.js:
	$('#hide').click(function(){
		$('#other').hide('slow');
	});
	$('#red').click(function(){
		$('#other').css('color','red');
	});
-->
Un saludo.