# Trying to set text\_area helper class for css =\> getting weirdness

**URL:** <https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540>\
**Category:** Rails\
**Created:** [March 4, 2010, 4:13am UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540 "2010-03-04T04:13:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [March 4, 2010, 4:13am UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540/1 "2010-03-04T04:13:54Z")

</div>

here’s my view code:

\<%= f.text\_area :notes, :cols =\> 40, :rows =\> 15, :class =\> ‘focus’ %\>

here’s what firefox shows is being gen’d:

note that I’m ending up with a class = “focus text\_area” instead of  
the expected “focus”

It doesnt look like I’m doing anything wrong, but… am I?

---

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [March 4, 2010, 10:32am UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540/2 "2010-03-04T10:32:34Z")

</div>

On Thu, Mar 4, 2010 at 4:10 AM, lunaclaire [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the expected “focus”
> 
> It doesnt look like I’m doing anything wrong, but… am I?

You are not doing anything wrong, and there is nothing wrong with the  
piece of code generated by rails. This is only saying that your  
element as two classes: ‘text\_area’, which is used by rails, and  
‘focus’.

–  
Gael Muller

---

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [March 4, 2010, 6:12pm UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540/3 "2010-03-04T18:12:06Z")

</div>

Ahh… good pt.

The thing is, I’m using this with some new jQuery stuff I’m doing  
where that code looks for input elements with a class == ‘focus’…  
Guess I’ll have to change that to look for elements _containing_ that  
class.

But, I’m curious why I dont get the dame thing for text\_fields…  
there the class just comes out as ‘focus’.

Any ideas about that?

---

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [March 4, 2010, 6:12pm UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540/4 "2010-03-04T18:12:41Z")

</div>

Ahh… good pt.

The thing is, I’m using this with some new jQuery stuff I’m doing  
where that code looks for input elements with a class == ‘focus’…  
Guess I’ll have to change that to look for elements _containing_ that  
class.

But, I’m curious why I dont get the dame thing for text\_fields…  
there the class just comes out as ‘focus’.

Any ideas about that?

---

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [March 4, 2010, 7:08pm UTC](https://www.ruby-forum.com/t/trying-to-set-text-area-helper-class-for-css-getting-weirdness/184540/5 "2010-03-04T19:08:54Z")

</div>

Ahh… good pt.

The thing is, I’m using this with some new jQuery stuff I’m doing  
where that code looks for input elements with a class == ‘focus’…  
Guess I’ll have to change that to look for elements _containing_ that  
class.

But, I’m curious why I dont get the dame thing for text\_fields…  
there the class just comes out as ‘focus’.

Any ideas about that?
