# Ruby JavaScript Classes

**URL:** <https://www.ruby-forum.com/t/ruby-javascript-classes/174803>\
**Category:** Ruby\
**Created:** [September 2, 2009, 2:15pm UTC](https://www.ruby-forum.com/t/ruby-javascript-classes/174803 "2009-09-02T14:15:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [September 2, 2009, 2:15pm UTC](https://www.ruby-forum.com/t/ruby-javascript-classes/174803/1 "2009-09-02T14:15:06Z")

</div>

Rails has JavascriptHelper but can you recommend other packages that  
make it easy for the Ruby programmer to create JavaScript on web pages?

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [September 2, 2009, 2:18pm UTC](https://www.ruby-forum.com/t/ruby-javascript-classes/174803/2 "2009-09-02T14:18:38Z")

</div>

Mike S. wrote:

> Rails has JavascriptHelper but can you recommend other packages that  
> make it easy for the Ruby programmer to create JavaScript on web pages?

I suggest you write native Javascript using jQuery - you’ll be glad you  
did. jQuery lets you work at the level of CSS selectors, e.g.

$(’.someclass’).hide(); // hide all elements with class someclass

The half-way house: install jRails and then the Rails helpers will  
output jQuery instead of Prototype.

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [September 2, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/ruby-javascript-classes/174803/3 "2009-09-02T16:46:48Z")

</div>

Brian C. schrieb:

> I suggest you write native Javascript using jQuery - you’ll be glad you  
> did. jQuery lets you work at the level of CSS selectors, e.g.
> 
> $(’.someclass’).hide(); // hide all elements with class someclass

The same with Prototype looks like this:

```
 $$('.someclass').invoke('hide');

```

jQuery is not as much better than Prototype as many people believe that  
just don’t know Prototype.

In the german JS-newsgroup the one and only answer to the question  
‘which JS-framework should I use?’ is ‘write your own. The existing ones  
are all bullshit’…

R.

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [September 3, 2009, 8:48pm UTC](https://www.ruby-forum.com/t/ruby-javascript-classes/174803/4 "2009-09-03T20:48:20Z")

</div>

I can recommend Prototype as well.

Also, there’s this great talk by a person who KNOWS about JS:

[![](https://img.youtube.com/vi/hQVTIJBZook/hqdefault.jpg "JavaScript: The Good Parts") ](https://www.youtube.com/watch?v=hQVTIJBZook)

(I know it’s an hour long, but I really took some lessons out of it. I  
think  
it’s worth the time investment)

and his great tool:

> **[JSLint: The JavaScript Code Quality and Coverage Tool](https://www.jslint.com/)**
>
> JSLint, The JavaScript Code Quality and Coverage Tool.
> This file allows JSLint to be run from a web browser.
> It can accept a source program and analyze it
> without sending it over the network.

that helped me remove a lot of errors from my javascript stuff…

In the german JS-newsgroup the one and only answer to the question  
'which

> JS-framework should I use?’ is ‘write your own. The existing ones are all  
> bullshit’…

I like that one 😉

There are tons of frameworks out there, just pick one that has the kind  
of  
syntactic sugar you favor…  
Greetz!
