2

I have the following code working with a simple datepicker; when I click on the button the picker displayed.

I need this to be work with a multidatespicker:

Simple datepicker JS script.

<script type="text/javascript"> 
$(document).ready(function(){
    $('#date').datepicker();
    $('#btnRepercute').click(function() {
          $('#date').datepicker('show');
      });
    });
    </script>

HTML input fields.

<input type="button" value="Répercuter" class="button" id="btnRepercute"/>
<input type="text" id="date" class="hidden" />

Attempts so far with multidatespicker

$('#date').multiDatesPicker();
$('#btnRepercute').click(function() {
      $('#date').multiDatesPicker();
});

Nothing happens, no errors in the console. Thanks in advance for your help!

jmetz
  • 12,144
  • 3
  • 30
  • 41
BYU
  • 75
  • 1
  • 13

1 Answers1

3

First you need to unregister the datepicker event and then attach the multiDatesPicker event , after that focus the element

$('#btnRepercute').click(function() {

  $("#date").datepicker( "destroy" );
 $('#date').multiDatesPicker();
 $('#date').focus();
});

Hope it works fine

M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118