JSFiddle - React, Tailwind, and code Playground
by gurkavcu
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css">
<select id="Plan_Id" name="Plan_Id">
<option value="30">Month</option>
<option value="365">Annual</option>
</select>
<input name="date" id="date_picker" type="text" class="text date_picker" />
<br/>
<br/>
<p>
m-d-Y. so if today is january 07 and i select 30 -> month my input will be populated with 02-06-2012
</p>
JavaScript
$(function() {
$("#date_picker").datepicker({
onSelect: function(dateText, inst) {
var selectedDay = new Date(inst.currentYear,inst.currentMonth,inst.currentDay);
selectedDay.setDate(selectedDay.getDate()+parseInt($("#Plan_Id").val(),10));
$(this).val((selectedDay.getMonth()+1)+
"-"+selectedDay.getDate()+
"-"+selectedDay.getFullYear());
}
});
});