# Change row font on click

**URL:** <https://www.ruby-forum.com/t/change-row-font-on-click/173248>\
**Category:** Rails\
**Created:** [August 5, 2009, 4:36pm UTC](https://www.ruby-forum.com/t/change-row-font-on-click/173248 "2009-08-05T16:36:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevoke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@trevoke](https://www.ruby-forum.com/u/trevoke)\
**Post date:** [August 5, 2009, 4:36pm UTC](https://www.ruby-forum.com/t/change-row-font-on-click/173248/1 "2009-08-05T16:36:28Z")

</div>

Here is the code to develop my table:

 \<% reports.each do |report| %\> "\> \<% if !report.old? %\> \<% else %\> \<% end %\> \<% end %\> 

| Name | Date | Age | Procedure |
| --- | --- | --- | --- |
| \<%=h "#{report.last}, #{report.first}" %\> | \<%=h report.date %\> | \<%=h report.age %\> | **\<%=h report.age %\>** | \<%=h report.proc %\> |

It’s really standard, nothing fancy.  
I’d like to be able to click on a row and change the texts in all cells  
to strike-through (and possibly, remove the strike-through when you  
click again).

What should I look for online… Or how do I do it?

---

<div class="post-metadata">

**Author:** ![trevoke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@trevoke](https://www.ruby-forum.com/u/trevoke)\
**Post date:** [August 5, 2009, 4:56pm UTC](https://www.ruby-forum.com/t/change-row-font-on-click/173248/2 "2009-08-05T16:56:31Z")

</div>

Aldric G. wrote:\>

> It’s really standard, nothing fancy.  
> I’d like to be able to click on a row and change the texts in all cells  
> to strike-through (and possibly, remove the strike-through when you  
> click again).
> 
> What should I look for online… Or how do I do it?

Aldric,

take a look at prototype’s Element.observe functionality, you can  
register a handler to change an element’s class when it is clicked…

Element.observe(“id of element”, “click” function(e) {  
e.addClassName(“css\_class\_name\_you\_provided\_for\_strikethrough”)  
})

There is also removeClassName and toggle which you should look at for  
the alternate case…
