Jquery datepicker as a popup?

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

I would like the html input that, when clicked, to make a jQuery date popup that populates the html input. http://docs.jquery.com/UI/Datepicker

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

Thank.

+3
source share
4 answers

Use jQuery user interface datapicker. It is very convenient to add and very user friendly.

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

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



<div class="demo">

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

</div><!-- End demo -->
+4
source

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

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

and js

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

You can also create an instance after clicking, which means that there is no hidden container of
another JS, but it still works

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

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

All Articles