Skip to content

Instantly share code, notes, and snippets.

@raytiley
Created January 30, 2013 23:36
Show Gist options
  • Save raytiley/4678433 to your computer and use it in GitHub Desktop.
Save raytiley/4678433 to your computer and use it in GitHub Desktop.
Just a simple jQueryUI based datepicker
<!-- This is the form element that will be transformed into a datepicker -->
<div type="text" id="ScheduleDate style="float:left;margin-left:15px">
<!-- This script finds the above datepicker and when a day is selected goes to the current url with a different date -->
<!-- EXAMPLE: http://YourServer/Schedule.php?date=2012-01-13 -->
<script>
$(function() {
$("#ScheduleDate").datepicker({
onSelect: function(dateText, inst) { window.location.href = location.href.substring(0,location.href.lastIndexOf("?"))+"?date="+dateText},
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment