Adding custom behaviors to a text_field?

Hello, I’m sure most of you have seen the forms, where people fill the
default value of a textbox with the field title, and then when you
click it, it empties the field for data to be entered. As I am fairly
new to ruby and rails, I am looking for an easy way to modify the
default behavior of a text_field, enabling it to create that effect.
I’m wondering if i should write a new helper function all together to
create this, or if there is simply a way to modify the existing
text_field behavior - as it will now have to handle displaying the
title, or if a value exists - the value. (And of course, some sort of
JS intervention will have to occur)

Thanks for your assistance!
-Paul