/ / jQuery Datepicker no responde [cerrado] - javascript, jquery, jquery-ui, datepicker

jQuery Datepicker no responde [cerrado] - javascript, jquery, jquery-ui, datepicker

Estoy usando este código datepicker muy simple de los documentos jQuery UI pero no funciona en mi Mac:

<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>

<body>
<input type="text" id="date-picker" />
<script>
$("#date-picker").datepicker();
</script>
</body>

¿Alguien puede decirme por qué no funciona? ¡Gracias de antemano!

Respuestas

2 para la respuesta № 1

jQuery UI depende de jQuery.

Por lo tanto, debe incluir el script jQuery antes del script jQuery UI:

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

No es necesario incluir jQuery dos veces tampoco. Lo anterior será suficiente.

Aquí hay un ejemplo de trabajo.


1 para la respuesta № 2

Debería agregar jquery antes de agregar jqueryui.
Agregaste jquery dos veces.Quita uno

<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<!--    <script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>-->


<body>
<input type="text" id="date-picker" />
<script>
$("#date-picker").datepicker();
</script>
</body>

1 para la respuesta № 3

sí, incluye jquery antes de jquery ui

<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
</head>

<body>
<input type="text" id="date-picker" />
<script>
$("#date-picker").datepicker();
</script>
</body>