Thanks Karl,

Not sure why i had never done that before, but now I'm going through
my code and adding the appropriate starting tag throughout my jquery.

This did speed things up quite a bit.

On Sep 24, 2:56 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
> For a start try using  $('div.divideDate'). This means that jQuery can
> just check "div" elements for the divideDate class rather than every
> element on the page.
>
> Karl Rudd
>
> On Thu, Sep 25, 2008 at 5:01 AM, pedalpete <[EMAIL PROTECTED]> wrote:
>
> > I thought I was getting the hang of jquery and javascript, but then i
> > wrote this small function, and it is really taking a long to run -
> > like 15+ seconds.
>
> > The purpose of the function is that i have a list of concerts ordered
> > by date.
> > I want to show the date when the date changes, so for all concerts on
> > Wed, Sep 24, I show the date as a heading on the first concert, and
> > then hide the rest of the date headings, and then for concerts on Thur
> > Sep 25, the date shows again on the first item, so users know they are
> > looking at a different day.
>
> > This way users get a clear division of dates.
>
> > the function I'm using is
> > [code]
> >        function showDateDivides(){
> >        $('.divideDate').livequery(function(){
> >                var dividedID = $(this).attr('id');
> >                var dateTable = $('#'+dividedID).html();
> >                var splitDateTable = dateTable.split(' ');
> >                var dayOfWeek = splitDateTable[0];
> >                var numOfMonth = splitDateTable[1];
> >                $('.dateTable#'+dividedID+':first').show();
> >                $('.dateTable#'+dividedID+':first
> > td#'+dayOfWeek).html(numOfMonth).addClass('firstDate');
> >        });
> > [/code]
>
> > the class divideDate is hidden in the css when the page loads,
> > The id holds the date formated in YYYY-mm-dd
> > the class dateTable holds a weekly view date table (so 7 squares), and
> > then the day of the week gets the date number and class of firstDate
> > added to it.
>
> > I hope that's clear. Is this really inefficient code?

Reply via email to