Append the URL with a Date selected from the jQuery “datepicker”

This will append you url so it will display “&date=2011-10-14″ using jQuery + jQuery UI (for the calendar picker).

<form action="" method="post" class="datepickerform">
<input id="datepicker"/>
<input type="submit" value="Go" />
</form>

and the javascript

<script type="text/javascript">
	// Datepicker
        $(document).ready(function(){
	$('#datepicker').datepicker({inline: true, dateFormat: 'yy-mm-dd'});

$("form").submit(function() {
  var pathname = window.location.pathname;
  var datepickedup = $("input#datepicker").val();
  window.location.href = (pathname + "?date=" + datepickedup);
  return false;
});
});
</script>

About bentedder

Ben Tedder is a front-end web developer. He loves WordPress, SharePoint, and Drupal, along with jQuery, CSS, and good 'ol HTML. +Ben Tedder on Google or follow @bentedder

Join the discussion!