I am trying to insert inline js in one of my haml templates.
As a test, I tried this answer @ Include inline JS in HAML
.center_div.style1-form#new_post
%h3= t(:blog, scope: :backoffice)
= simple_form_for([:backoffice, :blog, @post], :method => :post, :html => { :class => 'form-vertical', :autocomplete => "off" }) do |f|
.style1-form-header
%h1= t(:new_post, scope: :backoffice)
.style1-form-body
= f.error_notification
= render "backoffice/blog/posts/form", :f => f
.form-actions
= link_to backoffice_blog_posts_path, :class => "btn btn-default" do
%i.glyphicon.glyphicon-th-list
%span= t(:list, scope: :application)
= f.button :submit, t(:register, scope: :application), :class => "btn btn-primary"
:javascript
$(document).ready( function() {
$('body').addClass( 'test' )
} );;
but I get an error in the browser console :
[Error] ReferenceError: Can't find variable: $