# Mixing JS with check\_box\_tag

**URL:** <https://discuss.rubyonrails.org/t/mixing-js-with-check-box-tag/33845>\
**Category:** rubyonrails-talk\
**Created:** [September 1, 2008, 3:15am UTC](https://discuss.rubyonrails.org/t/mixing-js-with-check-box-tag/33845 "2008-09-01T03:15:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [September 1, 2008, 3:15am UTC](https://discuss.rubyonrails.org/t/mixing-js-with-check-box-tag/33845/1 "2008-09-01T03:15:41Z")

</div>

I have a check\_box\_tag in my code that the user clicks to add more information. When the checkbox is checked or unchecked I want to call a JS function I have written called toggleBox(). Does anyone know how to do this?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [September 1, 2008, 8:16am UTC](https://discuss.rubyonrails.org/t/mixing-js-with-check-box-tag/33845/2 "2008-09-01T08:16:12Z")

</div>

> I have a check\_box\_tag in my code that the user clicks to add more information. When the checkbox is checked or unchecked I want to call a JS function I have written called toggleBox(). Does anyone know how to do this?

pass an onclick option to the checkbox.

Fred
