I am trying to output some inline js on a page. I really do not want to add it to any JS file, because it is so arbitrary and used once. In doing so, I use haml and also try to use content_for to post JS after loading jquery from the layout.
The problem is that haml doesn't like multiline indented text (I think)
I am trying to do the following:
=content_for :javascript do $(function(){ $("#sell_tickets_here").live("vclick",function(){ if($(this).is("checked")) $("#tickets_here").display("inline"); else $("#tickets_here").display("none"); }); });
In my layout, I:
= yield(:javascript)
Which really works if I have only one line after the content_for statement.
javascript ruby-on-rails haml
Parris
source share