I have dropdown button. Based on selection, there should be an difference between from and to date. If I select 1st option, there should be difference of 10 days like from:16/11/2017 to:26/11/2017 and if I select 2nd option, difference is 30 days. I tried like this:
<select class="form-control" name="slct" id="slct" required style="font-
family : Verdana; font-size: 20px; height: 40px;" onchange="getResult()">
<option value="">Select</option>
<option value="10">select 1</option>
<option value="30">select 2</option>
<option value="60">select 3</option>
</select>
<table style="margin-top:10px;">
<tr>
<div class="form-group">
<td><label for="from" style="margin-left:30px">From:
</label>
<?php echo "<input type='date' class='form-control'
name='dte' id='dat' value='" . date('Y-m-d') . "' required />" ?> 
</td>
<td><label for="from">To:</label>
<input type="date" name="to" id="todate" value=""
required /> </td>
</div>
</tr></table>
<script>
function getResult() {
var dateval = $("#frmdate").val();
var offset = $("#slct").value();
if (dateval != "" && offset != "") {
var dat = $("#frmdate").datepicker("getDate");
dat.setDate(dat.getDate() + parseInt(offset));
$("#todate").text($.datepicker.formatDate("yy-mm-dd",
dat));
}
}
</script>
But the result is not shown. How can I get that? here I am displaying today's date before selection. But I want to display today's date after selection. Please suggest me how to display after selection.