Toggle Shipping Address

In my application, i am able to hide the shipping address in my view
if a checkbox is checked. I want to add some text (paragraph) in the
shipping section. I could not figure out how to make this behave like
the form. I need this hidden too until the checkbox is marked. Is this

You’ll probably want to do this in javascript. jQuery being the obvious choice. It’s absolutely possible, but it’s not at all related to RoR (unless there’s some way to get that behavior within the framework, which I’m unaware of).

<!DOCTYPE html>

<script type=‘text/javascript’
<script type=‘text/javascript’>

  $(document).ready(function() {

  $('#my_checkbox').click(function() {
    var current_display = $('#my_div').css('display');
    var new_display = (current_display == 'none') ? 'block' : 'none';
    $('#my_div').css('display', new_display);


<style type='text/css'>
  div.hide {
    display: none;


    <div><input type="checkbox" id="my_checkbox"></div>
    <div id="my_div" class='hide'>Hello world</div>