I am a new to js and am trying to figure out if there is a way to either modify an existing button within AnyTime Datepicker or add a new one that will clear the date from the field.
I see this as a possible solution, but can't figure out where to insert it into the anytime.js to prevent the AnyTime datepicker from breaking:
}).keyup(function(e) {
if(e.keyCode == 8 || e.keyCode == 46) {
$.datepicker._clearDate(this);
}
});
Okay, so I have below that works in Chrome / firefox, but not in IE 9. In IE 9 I click on Clear button and it brings up the date picker. If I click on it twice in IE it will clear the field. How can I get it to be compatible with IE9:
<tr>
<td>
<label class="width100 right displayInlineBlock padBottom5">Received:
<input class="width70 calendarBackground" type="text" maxlength="4000" name="received" id="received" value="<%=report.getFormattedReceived()%>" />
<script>
AnyTime.picker( "received", { format: "%d %b %y", firstDOW: 1 } );
</script>
<input type="button" id="receivedClear" value="Clear" />
<script>
$("#receivedClear").click( function(e) {
$("#received").val("").change(); } );
</script>
</label>
</td>
</tr>
Thanks!