Always visible jQuery DatePicker user interface

How can I use jQuery's user interface to display the datepicker visible widget?

+43
jquery-ui datepicker
Nov 15 '10 at 20:19
source share
3 answers

It's simple. Keep the jQuery code, but assign it a <div> instead of an input field.

 Date: <div id="datepicker"></div> <script> $(function() { $("#datepicker").datepicker(); }); </script> 

A functional example is on the jQuery UI webpage for the datepicker widget , and I also included it below.

 $(function() { $("#datepicker").datepicker(); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <div id="datepicker"></div> 
+66
Nov 15 '10 at 20:22
source share

From the documentation :

Just call .datepicker () in the div instead of typing.

(To display the datepicker element embedded in the page, not the overlay.)

+15
Nov 15 '10 at 20:20
source share
  .ui-datepicker { z-index: 1000; width: 17em; width:500px; padding: .2em .2em 0; display: none; position: absolute; padding: 100px 20px; top: 100px; left: 50%; margin-top: -100px; } 

I redefined the style above and now it works better

+3
Jan 16 '13 at 13:13
source share



All Articles