Menu Close

Add Date-picker in form using jQuery

Codeamend

If you want to add some datepickers on your form, simply focus on the following jQuery script. Click the input field to open an interactive calendar in a small overlay. Select the date then click elsewhere on the page to close the calendar. If a date is selected, feedback is shown as the input’s value.

Example Code:

<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Add Date-picker in form using jQuery</title>
 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
 <link rel="stylesheet" href="/resources/demos/style.css">
 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
 <script>
 $( function() {
   $( "#datepicker" ).datepicker();
 } );
 </script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
 

Output

Add Date-picker in form using jQuery

Date:

Posted in Codeamend, jQuery

You can also read...