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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Aug 25, 2011 at 5:34 PM, Allan M <allan.moster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
<!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> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.