JQuery Calendar - won't disappear on date selection

Posted on 2011-03-15
Last Modified: 2012-05-11
Hi I had this problem before but realised it was caused by bad JQuery syntax.  I'm a JQuery newbie so please bear with me :-).  It was ever since I added the code to set the date field to tomorrow's date that it started going wrong.  I'd be grateful if someone could tell me where I'm going wrong in my syntax.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Cross Keys Hotel, London/title>

<link rel="stylesheet" type="text/css" href="styles/baseline.css" />
<link rel="stylesheet" type="text/css" href="styles/jquery.lightbox-0.5.css" media="screen" />
<link rel="stylesheet" type="text/css" href="styles/jquery-ui.css" media="screen" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>

<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>

<script type="text/javascript">

$(document).ready(function() {

			onSelect: function(dateText, inst) {
				var s = dateText.split("/");


$("#Date").datepicker('option', {dateFormat: 'dd/mm/yy'}); 

var myDate = new Date();
    var day = myDate.getDate() + 1;
    var month = myDate.getMonth() + 1;
    var ukDate = day + '/' + month + '/' + myDate.getFullYear();

$('a[rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel



<body id="county" class="booking"> 

<div id="booking">
<h3>Find &amp; Book</h3>
<form name="bookingForm" id="bookingForm" method="post" action="" autocomplete="off">
<input name="$LICENCE$" type="hidden" value="xxxxxx" />
<input name="$SMOKING$" type="hidden" value="" />

<input name="$SOURCE$" type="hidden" value="" />
<input name="$LEDGER$" type="hidden" value="" />
<input name="$DAY$" id="Day" type="hidden" value="" />
<input name="$MONTH$" id="Month" type="hidden" value="" />
<input name="$YEAR$" id="Year" type="hidden" value="" />
<label for="Date">Arrival <br/> Date</label>
<input id="Date" name="Date" type="text" value="" autocomplete="off" class="required" />
<label for="Nights">Number <br/> of nights</label>
<!--<input id="Nights" name="$NIGHTS$" type="text" value="1" />-->
<select id="Nights" name="$NIGHTS$">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>

<option value="20">20</option>
<option value="21">21</option>
<input type="submit" name="Submit" value="Check for Availability" class="submit" />


Open in new window

Question by:Lorna70
1 Comment
LVL 19

Accepted Solution

Albert Van Halen earned 250 total points
ID: 35142681
Use 1 assignment of the the datepicker to your #Date element.
	onSelect: function(dateText, inst) {
		var s = dateText.split("/");
	dateFormat: 'dd/mm/yy'

Open in new window


Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question