I have two input text-fields, an “effective date” and an “expiration date.” I’m using jquerytool’s dateinput function as the date-picker.
Question:
When the “effective date” is picked, I’d like the “expiration date” to be one-year from the “effective date” and to set that value to the “expiration date” text-input field.
I cannot seem to get this all working…
<script>
$(document).ready(function() {
$(":date").dateinput({
format: 'mmmm dd, yyyy', // the format for example: 'October 04, 2012'
});
function expiration (){
// date calculations here?...
...
document.getElementById('expiration').value = expirationDate;
}
</script>
<input type="date" name="effective" id="effective" onChange="expiration()" />
<input type="date" name="expiration" id="expiration" />
1 Answer