我的jquery datepicker仅在刷新后加载

时间:2017-08-08 09:29:36

标签: javascript jquery jquery-ui-datepicker

这是我的头文件:

<link rel="stylesheet" type="text/css" href="<?php echo str_replace("/index.php/","/",base_url()); ?>assets/dtpicker/jquery.datepick.css"> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" async></script>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" async></script>
    <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" async></script>
    <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js" async></script>
    <script type="text/javascript" src="<?php echo str_replace("/index.php/","/",base_url()); ?>assets/dtpicker/jquery.plugin.js" async></script>
    <script type="text/javascript" src="<?php echo str_replace("/index.php/","/",base_url()); ?>assets/dtpicker/jquery.datepick.js" async ></script>
    <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js" async></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" async></script>
    <script src="https://use.fontawesome.com/0d83f3667e.js" async></script>
    <script src="<?php echo $assets ?>js/timepicki.min.js" async></script>
    <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js" async></script>

这是我页面底部的脚本。

<script>
    $(document).ready(function(){

        $("#date_pickup_").datepick({dateFormat: 'dd-mm-yyyy'});
        $("#date_drop_").datepick({dateFormat: 'dd-mm-yyyy'});     

    });
</script>

有关详情,请访问以下网站:http://www.yiyalo.com

1 个答案:

答案 0 :(得分:0)

在浏览器中加载页面我发现控制台出错了。在执行代码时,由于语法不正确而导致语法错误

$(document).ready(function()){
// click search btn
$("#searchCar").click(function(){
    searching(); 
}); 

你需要做这些

$(document).ready(function(){
 // click search btn
 $("#searchCar").click(function(){
    searching(); 
 })
})

该问题将得到解决