I have a div that I want to show or hide depending on whether a hyperlink is clicked. This obviously doesn't require any server-side interaction. But is there a way to do this using Rails' prototype helpers? Or should I simply use JQuery or pure Javascript to do this type of client-side manipulation?
views:
125answers:
2
                +2 
                A: 
                
                
              You should absolutely be using jQuery. The best reason is because of how little code it is:
$("a.myLink").click(function() { $("#myDiv").toggle() });
                  Yehuda Katz
                   2009-07-07 17:43:05
                
              Thanks. Wasn't sure if this went against the Rails way of doing things.
                  ipso facto
                   2009-07-07 17:59:26
                Not at all :) Virtually all serious Rails applications use custom JavaScript. The built-in helpers are just there to get you going quickly at first.
                  Yehuda Katz
                   2009-07-07 18:01:43
                Thanks. Slightly more verbose. But not as much as I expected from all the talk about how concise jquery is.
                  ipso facto
                   2009-07-07 18:24:57
                yeah... it's not a huge difference on trivial things, because Prototype in recent iterations has made the trivial syntax quite close to jQuery's. It adds up over larger applications though.
                  Yehuda Katz
                   2009-07-07 19:15:27