Skip to content

Instantly share code, notes, and snippets.

@johanb
Created August 22, 2011 11:49
Show Gist options
  • Select an option

  • Save johanb/1162209 to your computer and use it in GitHub Desktop.

Select an option

Save johanb/1162209 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<title>Test</title>
</head>
<body>
<p>Date: <input type="text" id="datepicker">&nbsp;<input type="text" id="alternate" size="30"/></p>
<a id="querylink" href="http://localhost:3000/?boardingtype=HP&departureairport=BRU&departuredate=2011-12-05&duration=11-16#">Blaat</a>
</body>
<script>
jQuery(function() {
$('#datepicker').datepicker({
onSelect: function(dateText, inst) {
var date_formatted = dateText.replace(/\//ig, "-");
var url = $("#querylink[href]").attr("href");
$("#querylink[href]").attr("href", url.replace(/departuredate=2011-12-05/ig, "departuredate=" +date_formatted));
}
});
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment