construyendo la opción altFormat altFormat
Sintaxis:
$(".selector").datepicker( { altField: "#field", altFormat: "mm-yy-dd" } );
Enfoque: Primero, agregue los scripts jQuery UI necesarios para su proyecto.
<enlace href = «https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css» rel = «hoja de estilo»>
<script src = «https://code. jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Ejemplo:
HTML
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <link href= "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"> </script> <!-- JavaScript code --> <script> $(function () { $("#gfg").datepicker( { altField: "#field", altFormat: "mm-yy-dd" } ); }); </script> </head> <body> <h1>GeeksforGeeks</h1> <h3>jQuery UI | datepicker altFormat option</h3> <!-- HTML --> <p>Enter Date: <input type="text" id="gfg"></p> <input type="text" id="field"> </body> </html>
Producción:
Referencia: https://api.jqueryui.com/category/widgets/