# Onmousover Element

**URL:** <https://www.ruby-forum.com/t/onmousover-element/109551>\
**Category:** Rails\
**Created:** [July 16, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/onmousover-element/109551 "2007-07-16T19:41:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eblatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7bcc69/32.png) [@eblatt](https://www.ruby-forum.com/u/eblatt)\
**Post date:** [July 16, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/onmousover-element/109551/1 "2007-07-16T19:41:46Z")

</div>

Hi,

I’m a little baffled. I’m trying to swap the CSS class when a user  
mouses over/out of a link. The idea seems simple enough, but I’m  
getting what seems to be a incorrect error message from Fireboug.

Here’s the error message:  
$(“section-one”).toggleClassName is not a function

It’s as if protoype is not loaded, which it is.

Here the code:

\<%= link\_to\_remote ‘Show’,  
{:url =\> {:controller =\> :dashboard ,  
:action =\> ‘show’ ,  
:id =\> organization.id } },  
{:class =\> ‘workspaceNav’,  
:onmouseover =\> “$(‘section-three’).toggleClassName(‘workspace-index-  
item-container-selected’)”,  
:onmouseout =\> “$(‘section-three’).toggleClassName(‘workspace-index-ite  
m-container-selected’)” }  
-%\>

I’ve also tried the following:

\<%= link\_to\_remote ‘Do’,  
{ :url =\> {:controller =\> :dashboard ,  
:action =\> ‘do’ ,  
:id =\> organization.id }},  
{ :class =\> ‘workspaceNav’,  
:onmouseover =\>  
“Element.toggleClassName(‘section-two’,  
‘workspace-index-item-container-selected’)”,  
:onmouseout =\> “Element.toggleClassName(‘section-two’,  
‘workspace-index-item-container-selected’)” }  
-%\>
