Title: RE: [Rails-spinoffs] EventPublisher (contribution)
Hi Guys,
 
What's the best way to grab all <td>'s in a particular table and manipulate them?
 
Here's the problem definition -
 
I have a table that has 'n' <tr>'s.
Each <tr> has couple of <td>'s and the first <td> has an image.
 
By default, each <td> has a 'x' class and image src is 'x.gif'.
But, when one is clicked, that one needs to be modified - the <td> class should change to 'y' and image src to 'y.gif'.
Simultaneously need to traverse through other <tr>'s and change the classes of the <td>'s to 'x' and their graphics to 'x.gif' so that I don't need to remember which one was highlighted earlier and which one is highlighted now.
 
Eg:
 
<table>
<tbody id=main>
<tr>
  <td class=x><a href="" src="">
  <td class=x>foo</td>
</tr>
 
<!-- ACTIVE -->
<tr>
  <td class=y><a href="" src="">
  <td class=y>foo</td>
</tr>
<!-- ACTIVE -->
 
<tr>
  <td class=x><a href="" src="">
  <td class=x>foo</td>
</tr>
</tbody>
</table>
 
Would the $$ function be the best bet?
 
Thoughts would be appreciated.
 
Thank you,
Mandy.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to