# RJS: Button to set style to visible

**URL:** <https://www.ruby-forum.com/t/rjs-button-to-set-style-to-visible/174026>\
**Category:** Rails\
**Created:** [August 19, 2009, 5:30pm UTC](https://www.ruby-forum.com/t/rjs-button-to-set-style-to-visible/174026 "2009-08-19T17:30:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maniga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@maniga](https://www.ruby-forum.com/u/maniga)\
**Post date:** [August 19, 2009, 5:30pm UTC](https://www.ruby-forum.com/t/rjs-button-to-set-style-to-visible/174026/1 "2009-08-19T17:30:59Z")

</div>

Hi everybody!

I’m back with a new question, this time about ruby on rails with  
javascript

I have a hidden div in my page and like to set its style to visible if  
someone clicks a button. But this:

# add new item

To add a non existing item choose the type of media:

 \<%= button\_to\_function '+ new item', update\_page { |page| page.setStyle('create\_new\_item', '{visibility:visible}')} %\> 

 \<%= form\_remote\_tag :url =\> {:action =\> 'items/create'}, :html =\> {:multipart =\> true}, :update =\> 'create\_new\_item' %\> 

Challenge Title:

 \<%= text\_field\_tag 'item' 'title'%\>   

Description:

 \<%= text\_field\_tag 'item' 'description'%\>  

Challenge Photo:

 \<%= file\_field\_tag :picture%\> \<%= submit\_tag 'Create' %\> 

only renders this javascript part:

There is no element and also not the change of the style included.

I think it’s a realy easy one, but I’m new with ruby on rails, so for me  
it isn’t 🙂

thanks for the help, manuel

---

<div class="post-metadata">

**Author:** ![maniga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@maniga](https://www.ruby-forum.com/u/maniga)\
**Post date:** [August 20, 2009, 12:58am UTC](https://www.ruby-forum.com/t/rjs-button-to-set-style-to-visible/174026/2 "2009-08-20T00:58:59Z")

</div>

Is there anybody who can help me? I’m also happy with a tutorial, I  
couldn’t find a good one.
