简体   繁体   English

不要在日期选择器 php 中显示之前选择的日期

[英]don't show previously selected date in date-picker php

I don't want to see previously selected date in date-picker (or how to clear the text box) in php.我不想在 php 的日期选择器中看到以前选择的日期(或如何清除文本框)。 It make difficult to select a different date or a new.很难将 select 更改为不同的日期或新的日期。 Please see the attached screen shot.请参阅随附的屏幕截图。

Please help请帮忙

enter image description here在此处输入图像描述

<script>
    $(document).ready(function() {
        $( "#datepicker" ).datepicker( {
            format: 'dd/mm/yyyy',
            todayHighlight: true,
            startDate: '-2d',
            endDate: '+0d',
            clearBtn : true,
        });
    });
</script>

This should solve your problem这应该可以解决您的问题

$('.datepicker').on('click', function(e) {
   e.preventDefault();
   $(this).attr("autocomplete", "off");  
});

You would then add it to your code like this然后你会像这样将它添加到你的代码中

<script>
    $(document).ready(function(){
        $( "#datepicker" ).datepicker({
            format: 'dd/mm/yyyy',
            todayHighlight: true,
            startDate: '-2d',
            endDate: '+0d',
            clearBtn : true,
        });
    });

    $('.datepicker').on('click', function(e) {
        e.preventDefault();
        $(this).attr("autocomplete", "off");  
    });
 </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM