如何使用JQuery将日期的当前变量显示给minDate

时间:2016-10-16 16:07:30

标签: php jquery datepicker

我有一个来自数据库的日期的php变量应该放在minDate中。

示例:

Php Code

<?php
//Example variable in PHP that was from the database
$get_frm_database = "2016-10-20";
?>

HTML表单

<html>
<head>
</head>
<body>

Datepicker:
<input type="text" name="" id="datepicker">

  <script>
  $( function() {
    $( "#datepicker" ).datepicker({
        dateFormat: "yy-mm-dd", 
        minDate: "+7D",   <----------This should be variable which is $get_frm_database
        maxDate: "+1M",
        showAnim: "show",
        showOn: "button",
        buttonImage: "date.png",
        buttonImageOnly: true,
        buttonText: "Select date"
    });
  } );
  </script>
</body>
</html>

我想要的是Php变量应该在minDate上。有人可以帮助并显示代码示例吗?提前谢谢。

1 个答案:

答案 0 :(得分:1)

尝试简单地回应它......

minDate: "<?php echo $get_frm_database; ?>",