Thanks Mike, I can't believe I missed that one. Using .join() to create the var works nicely too, and I assume the .length is quicker than an if statement? Looks simpler anyway.
Thanks Pete On Aug 21, 1:26 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > You have a typo on line 68 of selectDate.html. "updatedDate" should be > "updateDate". That's why updateDate is undefined in IE. > > BTW, here's a way you could write that bit of code without the repetition: > > var updateDate = [ > splitDate[1], > splitDate[2], > splitDate[3], > splitDate[4].length == 4 ? splitDate[4] : splitDate[6], > '' > ].join(' '); > > -Mike > > > From:pedalpete > > > Hey gang, > > > I've written a bit of jquery code which I am absolutely > > amazed works on both Safari and FF, but IE is giving me errors. > > > I've put the code on an external server so you can see what it is. > >http://zifimusic.com/mapickl/selectDate.html > > > Basically what I have is a select list which when hovered > > over user superfish as a dropdown menu. Then when hovering > > over the 'select date' option from the select list (which is > > actually superfish), the datepicker is shown. > > When a use selects a date, that date is updated in the select > > list as selected. > > > This works fine in Safari and FF, but when selecting a date > > in IE, the date is not passed to the select list. > > Here's the code I've got to get this all going. > > > [code] > > function updateDateForm(updateDate){ > > alert(updateDate); > > $('.updateDate').val(updateDate).html(updateDate); > > } > > > $('.dropped .item').livequery('click', function(){ > > var updateDate = $(this).html(); > > updateDateForm(updateDate); > > }); > > > $('.dropped .dateItem').each( > > function() > > { > > $this = $(this); > > > $this > > .datePicker() > > .bind( > > 'mouseover', > > function() > > { > > $(this).dpDisplay(); > > this.blur(); > > return false; > > } > > ) > > .bind( > > 'dateSelected', > > function(e, selectedDate, $td) > > { > > var getDate = ' '+selectedDate; > > var splitDate = getDate.split(" "); > > if(splitDate[4].length!=4){ > > var updatedDate = > > splitDate[1]+' '+splitDate[2]+' > > '+splitDate[3]+' '+splitDate[6]+' '; > > } else { > > var updateDate = > > splitDate[1]+' '+splitDate[2]+' > > '+splitDate[3]+' '+splitDate[4]+' '; > > } > > updateDateForm(updateDate); > > } > > ); > > }); > > [/code] > > > The reason I'm doing all of this is to get a somewhat clean > > and simple UI for selecting a date (date-range likely coming > > soon). The way I had it before, without a select list, meant > > that the look was very inconsistent, particularly with Safari. > > > Thanks, > > Pete