Adrian Adrian - 1 month ago 7
jQuery Question

How to display current variable of date to minDate using JQuery

I have a php variable for date that was from database that should be put in minDate.

Example:

Php Code

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


HTML Form

<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>


What I want is that the Php variable should be on minDate. Can someone help and show an example of codes? Thanks in advance.

Answer

Try to simply echoing it...

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