Awesome!  Thanks for the code.  :)

I agree, I should not set the id as id's are unique identifiers.  What
I wanted to do was take the class name and id name from a previous <tr
/> and combine them into a new class name like so:

from:   class="row" id="blah-one"
to:     class="row blah-one"

I modified your code a bit to achieve this.  Thank you!

Shane

On 2/21/07, Kristinn Sigmundsson <[EMAIL PROTECTED]> wrote:
> this does it for the classes
>                 $("table tr:not([EMAIL PROTECTED])").each(function() {
>                         $(this).attr("class", $(this).prev("[EMAIL 
> PROTECTED]").attr("class"));
>                 });
> you might be able to get it down to one row...
>
> I would not recommend setting the IDs as you want, because the
> standars clearly states that IDs should be UNIQUE!
>
> //Kristinn
>
> On 2/21/07, Shane Graber - jQuery <[EMAIL PROTECTED]> wrote:
> > I'm stumped on how to do this with jQuery.  I have a table like this:
> >
> > <table>
> >
> >     <tr class="row" id="blah-one">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr>
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr>
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row" id="blah-two">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr>
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr>
> >         <td>
> >         </td>
> >     </tr>
> >
> > </table>
> >
> > I need to convert it to:
> >
> > <table>
> >
> >     <tr class="row" id="blah-one">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row blah-one">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row blah-one">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row" id="blah-two">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row blah-two">
> >         <td>
> >         </td>
> >     </tr>
> >
> >     <tr class="row blah-two">
> >         <td>
> >         </td>
> >     </tr>
> >
> > </table>
> >
> > Basically, I want to look at each table row and if it does not have a
> > class, I want to look up the table row by row till it finds a row that
> > has a class and id set on it and then take that class and id and apply
> > it to that row that does not have its class set.
> >
> > What I am attempting to do is to write a show/hide script for phpBB so
> > that I can dynamically show/hide sections of the forum tree either
> > collapsed or expanded.  So far I have been successful at applying a
> > class and id to each table row section but not the rows directly
> > beneath it yet.
> >
> > Any help would be appreciated.  Thanks!
> >
> > Shane
> >
> > --
> > ---------
> > Bender: "Amy, you like cute things so I baked you a pony."
> > ---------
> >
> > http://www.reefs.org - Where reefkeeping begins on the internet.
> > http://www.advancedaquarist.com - High quality, free monthly publication for
> > the reef keeping hobbyist.
> > http://www.aquaristcourses.org - Distance learning courses for the
> > marine aquarist.
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>


-- 
---------
Bender: "Amy, you like cute things so I baked you a pony."
---------

http://www.reefs.org - Where reefkeeping begins on the internet.
http://www.advancedaquarist.com - High quality, free monthly publication for
the reef keeping hobbyist.
http://www.aquaristcourses.org - Distance learning courses for the
marine aquarist.

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to