jQuery - Widget DatePicker


Advertisements

Description

The Widget DatePicker function can be used with widgets in JqueryUI. It is focus on the input to open an interactive calendar in a small overlay.

Syntax

Here is the simple syntax to use DatePicker −

$( "#datepicker" ).datepicker();

Example

Following is a simple example showing the usage of DatePicker −

<!doctype html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <title>jQuery UI Datepicker - Default functionality</title>
		
      <link rel = "stylesheet" 
         href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
			
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
      </script>
 
      <script>
         $(function() {
            $( "#datepicker" ).datepicker();
         });
      </script>
   </head>

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

This will produce following result −

jquery-widgets.htm
Advertisements