BYU
BYU

Reputation: 73

JQuery's multiDatesPicker not working

I need to implement a multi dates calendar. I tried to follow this example : http://multidatespickr.sourceforge.net/

Unfortunately this is not working, no error displayed on the console. Nothing happens. I probably forgot something.

Thanks in advance for your help. My code is as shown below.

Included js files.

<script type="text/javascript" src="jsCalendar/jquery-1.7.2.js"></script>
<script type="text/javascript" src="jsCalendar/jquery.ui.core.js"></script>
<script type="text/javascript" src="jsCalendar/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="jsCalendar/jquery-ui.multidatespicker.js"></script>

Code inside the script tag to initialize the multiDatesPicker instance.

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

HTML to bind the multiDatesPicker instance.

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

PS: i need the simplest usage

Upvotes: 2

Views: 4174

Answers (3)

Sharma Vikram
Sharma Vikram

Reputation: 2470

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

Upvotes: 1

Suresh Atta
Suresh Atta

Reputation: 121998

Wrap your code in document ready

$(document).ready(function(){
   ------your code-----
});

see: Why wrap code into 'document ready'

Upvotes: 2

Jeff Noel
Jeff Noel

Reputation: 7618

You forgot to call the code when the document is ready.

Put your Javascript code in between those:

$(document).ready(function(){
    /* YOUR CODE HERE */
});

Upvotes: 5

Related Questions