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
possible?

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>
<html>
<head>
<title>Test</title>

<script type=‘text/javascript’
src=‘http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js’></script>
<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);
    });

  });
</script>

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

</head>

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

</html>