Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap Datepicker error

I tried everything but can't get the datepicker to show up.

Bootstrap version v2.3.1.

Latest version of http://www.eyecon.ro/bootstrap-datepicker/

HTML:

<div class="input-append date" id="dpMonths" data-date="102/2012" data-date-format="yyyy-mm" data-date-viewmode="years" data-date-minviewmode="months">
<input class="" size="16" type="text" value="2013-03" readonly>
<span class="add-on"><i class="icon-calendar"></i></span>

<script src="js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(function() {
    $('#dpMonths').datepicker();
});
</script>

Javascript error:

Uncaught TypeError: Cannot read property 'fn' of undefined

Uncaught ReferenceError: $ is not defined

like image 260
John Avatar asked Jan 29 '26 07:01

John


1 Answers

You need to have jquery included to get the bootstrap date picker working

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>

Also add the CSS file for bootstrap datepicker in the head of your page.

like image 69
Eli Stone Avatar answered Jan 30 '26 20:01

Eli Stone