Reputation: 73
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
Reputation: 2470
<script type="text/javascript">
$(document).ready(function(){
$("#date").multiDatesPicker();
$("#btnRepercute").click(function () {
$("#date").multiDatesPicker("show");
});
});
Upvotes: 1
Reputation: 121998
Wrap your code in document ready
$(document).ready(function(){
------your code-----
});
see: Why wrap code into 'document ready'
Upvotes: 2
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