# How to update element on view during onclick with RJS?

**URL:** <https://www.ruby-forum.com/t/how-to-update-element-on-view-during-onclick-with-rjs/92563>\
**Category:** Rails\
**Created:** [April 20, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/how-to-update-element-on-view-during-onclick-with-rjs/92563 "2007-04-20T19:12:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sneptune](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sneptune](https://www.ruby-forum.com/u/sneptune)\
**Post date:** [April 20, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/how-to-update-element-on-view-during-onclick-with-rjs/92563/1 "2007-04-20T19:12:45Z")

</div>

Hi,

I am trying to set up a drop down menu. When the item on the drop down  
list has been changed, I would like to display a textbox. Is there  
anyway to execute RJS during in onclick or onchange event of the  
select\_tag?

---

<div class="post-metadata">

**Author:** ![sneptune](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sneptune](https://www.ruby-forum.com/u/sneptune)\
**Post date:** [April 21, 2007, 3:43am UTC](https://www.ruby-forum.com/t/how-to-update-element-on-view-during-onclick-with-rjs/92563/2 "2007-04-21T03:43:26Z")

</div>

> I am trying to set up a drop down menu. When the item on the drop down  
> list has been changed, I would like to display a textbox. Is there  
> anyway to execute RJS during in onclick or onchange event of the  
> select\_tag?

Wai,

Check out the observe\_field prototype helper:  
[http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005064](http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005064)

That should be the ticket.

Hope this helps,

–  
Zack C.  
[http://depixelate.com](http://depixelate.com)
