¿Jquery datepicker como ventana emergente?

I am very new to jquery and only basic experience with javascript.

I would like an html input that when clicked would make the JQuery datepicker popup, which would fill in the html input. http://docs.jquery.com/UI/Datepicker

Can someone give me an example on how to accomplish this or give me a link that will point me in the right direction?

Gracias.

preguntado el 22 de mayo de 12 a las 16:05

You have the right link already, click the "view source" button down below or try this link and again look for the "view source" button. jqueryui.com/demos/datepicker -

u r asking as jquery ui dialog popup? -

2 Respuestas

Use the jQuery UI datapicker. It is very use to add and very easy for a user to use.

http://jqueryui.com/demos/datepicker/

<script>
$(function() {
    $( "#datepicker" ).datepicker();
});
</script>



<div class="demo">

<p>Date: <input type="text" id="datepicker"/></p>

</div><!-- End demo -->

contestado el 22 de mayo de 12 a las 20:05

Create it in a div, and then pop it, this is the easiest way.

<div id="datepickerholder" style="display: none;">
    <div id="datepicker"></div>
</div>
<a id="pop">pop datepicker</a>

y el JS

<script>
$(function() {
    $("#datepicker").datepicker();
    $("#pop").click(function(){
        $("#datepickerholder").show();
    });
});
</script>

You can also create the instance after the click, which means, there's no hidden container
another JS, but still works

<div id="datepicker"></div>
<a id="pop">pop datepicker</a>

<script>
$(function() {
    $("#pop").click(function(){
        $("#datepicker").datepicker();
    });
});
</script>

contestado el 22 de mayo de 12 a las 16:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.