// declare dates here for access by all events
var firstdateel=false;
var lastdateel=false;
// or you could select hidden input elements and use those
var $firstdate = $("input");
var $lastdate = $("input");
// select all dates
var $dates=$("td.selectabledate");
// declare the range variable for access by all events
var $range=$("noelements"); // deliberately select no elements
// attach the click event
$dates.click(function(){
// if firstdateel is unset or lastdateel is set, then start a new range
if (!firstdateel || lastdateel) {
firstdateel=this;
lastdateel=null;
// Do stuff to previous $range (if there was a previous selection,
you'll probably want to unhighlight it before resetting it)
$range=$("noelements");
// Starting new date range, do stuff to update ui
}
else {
lastdateel=this;
var $range=$($dates).lt($dates.index(lastdateel)+1); // filter out
dates after the last one
$range=$range.gt($dates.index(firstdateel)-1); // filter out dates
before first one
// Finished selecting range, do stuff to update ui
}
});
Blair
On 12/14/06, mylocal <[EMAIL PROTECTED]> wrote:
I have been trying to do a inline calendar for a client where you select
the
arrival date and then departure date and once the second click is
registered
in gives me an array of elemets between the two depending on class and
highlights those spaces if there available.
some code here at present : http://clients.ozdesign.com/104/book.php
This is a work in progress, whilst trying to understand jquery more.
--
View this message in context:
http://www.nabble.com/Select-All-elements-between-clicks--need-help-please-tf2817436.html#a7863807
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/