According to doc: https://github.com/eternicode/bootstrap-datepicker#no-conflict
bootstrap datepicker can now use noConflict:
var datepicker = $.fn.datepicker.noConflict(); $.fn.bootstrapDP = datepicker;
He said: "give $ (). BootstrapDP the bootstrap-datepicker function", what does this mean? Does this mean that I can use $("#object").bootstrapDP() instead of $("#object").datepicker() ?
I tried this in firefox (just for a test that does not actually conflict with any js), but the "date-select" does not appear, and the error does not appear (from firebug), which is strange.
Below is my code:
HTML
<div class="input-append date" id="dp3" data-date-format="dd-mm-yyyy"> <input class="span2" size="16" type="text" readonly><span class="add-on"><i class="icon-th"></i></span> </div>
Js
<script> $(function(){ var datepicker = $.fn.datepicker.noConflict; $.fn.bootstrapDP = datepicker; $("#dp3").bootstrapDP(); }); </script>
When I replace the script with $("#dp3").datepicker() , "date-select" is displayed. Can someone tell me how to use noConflict to load datepicker?
jquery twitter-bootstrap datepicker
morgan117
source share