I need to show the date picker in an input field that is inside a form. I have index.php which has the code for the date picker, I just need to link it to the input field. I have the form in another file as follows:

<form id="inputArea" action="index.php?action=login" method="post">
<input type="text" name="datepicker" value="<?php echo $array['date'];?>"/>
<label for="date">Date of Birth (mm-dd-yyy):</label>

the code for the datepicker in index.php is:

<script type="text/javascript">

$(document).ready(function() {

	var $datepicker = $( '#datepicker' );

			changeMonth: true,
			changeYear: true



It's not working because your selector doesn't exist:

$('#datepicker'); // This means an element with id="datepicker"
$('input[name=datepicker]');  // This means an input element with name="datepicker"

To resolve, change your selector, or add an id attribute of datepicker to your input field.


Thank you very much the second one worked for me.