Search code examples
twitter-bootstrapdatapicker

Bootstrap datepicker - Please be specific because the other examples are too generic


I am following the guide at https://github.com/eternicode/bootstrap-datepicker to implement a simple startDate/endDate datapickers layout.

I copypasted the code from the examples in fiddle but it won't work.

Do I need to import the CSS to make it work?? If it is not the CSS the problem, than what is that is preventing the data-pickers from showing up?

This is a part of the code: $('#date-start').datepicker().on('changeDate', function(ev){

    if (ev.date.valueOf() > endDate.valueOf()){
        $('#alert').show().find('strong').text('The start date must be before the end date.');
    } else {
        $('#alert').hide();
        startDate = new Date(ev.date);
        $('#date-start-display').text($('#date-start').data('date'));
    }
    $('#date-start').datepicker('hide');
});

this is the fiddle example

http://jsfiddle.net/wadvc/

Solution

  • You need to include Bootstrap and the 'datepicker' plugin.. your fiddle doesn't seem to have these.

    Here is a working demo on Bootply which includes the Bootstrap for you.