Could it be failing on your query?

jQuery(' > img', this).attr(alt);

I beleive that there has to be something before the >. The way it's set,
you're saying all img tags that are the child of nothing.

jQuery('body > img', this).attr(alt);

might be better, but I don't know what you're looking for precisely.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of KnoxBaby
Sent: Thursday, April 24, 2008 9:33 AM
To: jQuery (English)
Subject: [jQuery] Re: jQuery to create dynamic HTML-Content in a table


If i use

uid = jQuery(' > img', this).attr(alt);

no more code after this line is being executed :(

E.g.:

[code]
$('table tr:eq(0) td:gt(0)').each(function(i) {
                // If it's a col that contains an <img> (than the <td> has
the class
'imgg')
                if($(this).is('.imgg'))
                {
                        alert(i);
                        $(this).append('#1');

                        // Read out img's alt-attribute and save to array
                        uid = jQuery('> img', this).attr(alt);
                        uids[ i ] = uid;

                        // Testoutput to the matched header-column
                        $(this).append('#2');
                }
        });
[/code]

#1 is prepended, but #2 not :( And #1 only for the first <td> even though
there are more matched td's ...

On 24 Apr., 11:52, KnoxBaby <[EMAIL PROTECTED]> wrote:
> ah ok cool, thanks so far. I'm gonna try this out! If anybody has more 
> tipps on how to achieve my goal, just reply :) Thanks a lot!!!
>
> On 24 Apr., 10:38, "Aaron Heimlich" <[EMAIL PROTECTED]> wrote:
>
> > On Thu, Apr 24, 2008 at 3:31 AM, KnoxBaby <[EMAIL PROTECTED]> wrote:
>
> > > E.g. I don't know how to combine $(this) in the each function with 
> > > another selector.
>
> > > $(this + ' > img').attr('alt') didn't work to get the content of 
> > > the 'alt' attribute (which serves to be the UID)... Same with the tid
...
>
> > Try this:
>
> > jQuery('> img', this).attr('alt');
>
> > jQuery() has a second parameter which allows you specify the "context"
> > (basically, where to start searching from) of a selector. It 
> > defaults to document if not specified.
>
> > > On 24 Apr., 09:18, KnoxBaby <[EMAIL PROTECTED]> wrote:
> > > > I thought to do it perhaps this way:
>
> > > > -First read the header (columns). Thererfor, I have to provide 
> > > > something like <div id="%uid%"></div> in it so that jQuery can 
> > > > read out how many names there are and "save" their uids in an 
> > > > array
> > > > -Secondly: Go throught each <tr> and prove wether the first <td> 
> > > > contains a date mm.dd.yyyy (if not, than it's a perhaps the row 
> > > > with "April 08" etc ...). If yes, save the tid (therefor, 
> > > > provide something
> > > > like: <div id="%tid%"></div>)
> > > > -In this <tr> (if it's a date) go through each <td> and insert 
> > > > the html code with the %tid% and take the uid from the 
> > > > uids-Array
>
> > > > Could somebody help me with it since I don't know much about it 
> > > > :(
>
> > > > On 23 Apr., 22:13, KnoxBaby <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello,
>
> > > > > I have a big table. It has a header on the right side (dates) 
> > > > > and on the top (names of persons).
> > > > > Each date has an ID (tid) and each person an user-id (uid). 
> > > > > This table is generated in PHP:
>
> > > > >http://img117.imageshack.us/img117/7624/zwischenablage02ow0.jpg
> > > > >(Table
> > > > > Layout)
>
> > > > > Each user can set for himself a preference (Yes, No, Perhaps) 
> > > > > to a date.
>
> > > > > Therefor, he hovers in his column a row and the following 
> > > > > html-code comes up (marked pink):
>
> > > > >http://img373.imageshack.us/img373/7711/zwischenablage04aa7.jpg
>
> > > > > To achieve that, I do the following:
>
> > > > > I use an ID ($cell_id = $tid . $uid) for each cell and 
> > > > > print-out something like that:
>
> > > > > <div onmouseover="toggleOn($cell_id)"
> > > > > onmouseout="toggleOff($cell_id)"> show here the actual status 
> > > > > symbol ...
> > > > > </div>
> > > > > <div id="$cell_id">
> > > > > Edit:
> > > > > ...the 3 links to change status to with their symbols as link 
> > > > > </div>
>
> > > > > You can imagine that it's a lot of code. The filesize is about 
> > > > > 1.3MB and takes ages to load (the person that "runs" the 
> > > > > date-planer wants it like that; to show up all dates and 
> > > > > persons on ONE page). Now I removed the code that makes the 
> > > > > hover and the hidden-div with the change-links and get only about
177Kbyte.
>
> > > > > Now I ask myself if it would be possible with jQuery to manage 
> > > > > it somehow ...
>
> > > > > Any ideas?
>
> > > > > Thanks!!!!
>
> > --
> > Aaron Heimlich
> > Web Developer
> > [EMAIL PROTECTED]://aheimlich.freepgs.com/


Reply via email to