# Implemention of "Click on an icon and show a hidden div"

**URL:** <https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761>\
**Category:** Rails\
**Created:** [February 7, 2007, 3:18pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761 "2007-02-07T15:18:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [February 7, 2007, 3:18pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761/1 "2007-02-07T15:18:07Z")

</div>

I checked the prototypehelper and find the method show

```auto
show(*ids)

Shows hidden DOM elements with the given ids.

```

but I 'm not sure how to integrate these.

Should I have a function and a corresponding rjs to do this?

or I can just do it in the original rhtml?

THX

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [February 7, 2007, 3:34pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761/2 "2007-02-07T15:34:47Z")

</div>

You can use the PrototypeHelper functions straight from your web page  
(e.g. from an onclick event handler) or you can make call Prototype  
functions directly… it is just a JavaScript library, after all. For  
complete details on using Prototype directly check out http://  
[www.prototypejs.org](http://www.prototypejs.org). RJS comes into play, for example, when the  
request needs to go through the server from an AJAX call.

-Bill

On Feb 7, 9:18 am, Bontina C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [February 7, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761/3 "2007-02-07T15:58:51Z")

</div>

Bill S. wrote:

> You can use the PrototypeHelper functions straight from your web page  
> (e.g. from an onclick event handler) or you can make call Prototype  
> functions directly… it is just a JavaScript library, after all. For  
> complete details on using Prototype directly check out http://  
> [www.prototypejs.org](http://www.prototypejs.org). RJS comes into play, for example, when the  
> request needs to go through the server from an AJAX call.
> 
> -Bill
> 
> On Feb 7, 9:18 am, Bontina C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

I’m testing

foo
show foo

but the foo just won’t show up.

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [February 7, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761/4 "2007-02-07T16:36:57Z")

</div>

Try this:

\<%= link\_to(‘show foo’, ‘#’, :onclick =\> “Element.show(‘foo’); return  
false;”) %\>

And make sure the page is loading the Prototype javascript in the  
header.

HTH,  
Kevin S.

---

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [February 7, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/implemention-of-click-on-an-icon-and-show-a-hidden-div/84761/5 "2007-02-07T16:53:59Z")

</div>

Using Firefox with the Firebug extension can really help debug these  
kind of problems.

On Feb 7, 9:58 am, Bontina C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
