0

I am trying to use datepicker in a form which is created in a php file. I can see the datepicker icon on the webpage but when I click on that it does not work. However, when I create this form on a simple html file, same code is working. I am not sure if something is missing here.

Here's the php code:

<html>
  <head>
    <script> 
      $(function () { 
      $('#datepicker').datepicker({ 
        autoclose: true, 
        todayHighlight: true, 
      }).datepicker('update', new Date()); 
      }); 
    </script>
 </head>
<body>
<div class="container">
<form id="myForm">
<?php 
echo "
<div class='form-group'>
<label>Date: </label>
<div id='datepicker' class='input-group date' data-date-format='dd-mm-yyyy'> 
<input class='form-control' type='text' name='date'/> 
<span class='input-group-addon'> 
<i class='glyphicon glyphicon-calendar'></i> 
</span> 
</div> 
</div>
<form>
</div>
</body>
</html>

0