It looks like you're trying to initialize a datepicker when there's no #datepicker
element in DOM yet (the corresponding input
follows <script>
element, not vice versa).
As $('#datepicker')
will still return a jQuery-wrapped object (not null
!), no error will be thrown.
To solve this, either make this call when DOM is loaded:
$(function() {
$('#datepicker').datepicker();
});
or move this script into very end of <body>
element.
I'd choose the first option; moving all the DOM-ready actions into the same $(function() { ... });
wrapper as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…