我嘗試在我的Symfony 2.7項目中使用jquery.datetimepicker,但是當我在我的視圖中調用datetimepicker時不加載日期和時間。控制檯顯示此錯誤:Uncaught TypeError:undefined不是函數jquery.datetimepicker.js:1619(匿名函數)
Uncaught TypeError: undefined is not a function jquery.datetimepicker.js:1619(anonymous function)
這是我的代碼:
<div class="contact">
<div class="company_address">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.</p>
</div>
<div class="contact-form" >
{{ form(form) }}
<button type="submit" class="cancel" name="cancel" onclick="location.href = '{{ path('assistance_list') }}'">Cancel</button>
</div>
<div class="clear"></div>
<script>
$(document).ready(function() {
$.datetimepicker.setLocale('en');
$("#daiquiri_daiquiribundle_assistance_date input").each(function() {
$(this).attr("readonly", "readonly");
});
$('#daiquiri_daiquiribundle_assistance_date_date').datetimepicker({
format: "Y-m-d",
timepicker: false,
datepicker: true,
theme: 'dark'
});
$('#daiquiri_daiquiribundle_assistance_date_time').datetimepicker({
format: "H:i",
timepicker: true,
datepicker: false,
step: 10,
theme: 'dark'
});
});
</script>
</div>
您是否加載了jQuery UI Datepicker? 'datetimepicker'依賴於它。 – Barmar
這是哪裏'daiquiri_daiquiribundle_assistance_date_date' –
這是我想要加載datetimepicker的輸入的id。 – eliecerSR