Tôi tìm thấy vài câu trả lời trên ngăn xếp tràn nhưng vẫn không thể giải quyết vấn đề của tôi. Tôi đang chạy trên Django nhưng tôi không nghĩ rằng nó có liên quan cho lỗi này.
Tôi cố gắng để làm cho công việc java script bảng chọn ngày của tôi, nhưng tôi nhận được lỗi
1:27 lỗi chưa gặp:. $ (...) datepicker không phải là một chức năng (chức năng ẩn danh) @ 1: 27fire @ jquery-1.9.1.js: 1037self.fireWith @ jquery-1.9.1.js: 1148jQuery.extend.ready @ jquery-1.9.1.js: 433đã hoàn thành @ jquery-1.9.1.js: 103 jquery-2.1 .0.min.js: 4 XHR tải xong: POST "https://localhost:26143/skypectoc/v1/pnr/parse" .l.cors.a.crossDomain.send @ jquery-2.1.0.min.js: 4o.extend.ajax @ jquery-2.1.0.min .js: 4PNR.findNumbers @ pnr.js: 43parseContent @ contentscript.js: 385processMutatedElements @ contentscript.js: 322
Đây là tất cả các tập lệnh của tôi:
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.dateinput').datepicker({ format: "yyyy/mm/dd" });
});
</script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="http://getbootstrap.com/dist/js/bootstrap.min.js"></script>
<!-- Just to make our placeholder images work. Don't actually copy the next line! -->
<script src="http://getbootstrap.com/assets/js/vendor/holder.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="http://getbootstrap.com/assets/js/ie10-viewport-bug-workaround.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#extra-content").hide();
$("#toggle-content").click(function(){
$("#extra-content").toggle();
});
});
</script>
bất kỳ thông tin phản hồi sẽ rất cảm kích
Bạn chỉ nên gọi jQuery một lần cho một bắt đầu – Andy
Vâng, vì bạn đã có jquery-ui.js thích hợp và nó vẫn nói rằng datepicker() không phải là một hàm, có thể bộ chọn của bạn không chính xác? Có $ ('. Dateinput') tồn tại sau khi tải trang hoặc nó đang được thêm tự động và kiểm tra lại rằng đó là một tên lớp và không phải là id (($ ('# dateinput'))) – Kyle
Thực ra khi tôi loại bỏ phần bao gồm jquery < tập lệnh src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"> Tôi không nhận được lỗi này nữa, cảm ơn Andy –