Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always visible jQuery UI DatePicker

How can I use jQuery UI to display an always-visible datepicker widget?

like image 895
Piotr G Avatar asked Nov 15 '10 20:11

Piotr G


People also ask

How do I make my Datepicker always visible?

Simply call . datepicker() on a div instead of an input. (To display the datepicker embedded in the page instead of in an overlay.) Save this answer.

How to use jQuery ui datepicker?

The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.

How can I hide Datepicker after selecting date in jQuery?

Syntax: $(". selector"). datepicker("hide");

How to use datepicker in JavaScript?

We can include datepicker feature in our javascript program by specifying the below inside the <head> and <body> tags. Inside <head> we have to use “datepicker. min. css” and inside <body> tag use “datepicker.


2 Answers

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

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

A functional example lives at the jQuery UI webpage for the datepicker widget, and I've also included one 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>
like image 98
Cᴏʀʏ Avatar answered Oct 14 '22 00:10

Cᴏʀʏ


From the documentation:

Simply call .datepicker() on a div instead of an input.

(To display the datepicker embedded in the page instead of in an overlay.)

like image 33
Jeff Sternal Avatar answered Oct 14 '22 00:10

Jeff Sternal