I\'m trying to add Froala editor to my project.
Problem only on production server(on localhost it works fine) I\'m using rails 4.1.0 In gemfile i\'m have
<
An solution working for me is:
Separate files
create assets/javascripts/jquery_init.js content :
//= require jquery
//= require jquery.turbolinks
//= require jquery.cookie
//= require jquery.ui.all
//= require jquery_ujs
an call before aplication.js
<%= javascript_include_tag "jquery_init" %>
<%= javascript_include_tag "application", :async => !Rails.env.development?, "turbolinks-data-track" => true %>
Replace application.html.erb
<%= javascript_include_tag "application" 'data-turbolinks-track' => true %>
to
<%= javascript_include_tag "application" %>
try switching these lines:
<%= javascript_include_tag "vendor/modernizr" %>
<%= javascript_include_tag "application" 'data-turbolinks-track' => true %>
will become
<%= javascript_include_tag "application" 'data-turbolinks-track' => true %>
<%= javascript_include_tag "vendor/modernizr" %>
Here's what I did, it worked for me:
Surround your script with window.onload = function () { };
so your js will be executed only when the page load:
window.onload = function () {
$(function() {
$('div#content').editable({
inlineMode: false
})
});
};
This was my solution:
Put this in your app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs
and install this gem file:
gem 'jquery-rails'
How do you have the foundation added to the project?
In app/assets/javascripts/aplication.js
I had the same error
$ is no defined
and I resolved by reloading the foundation js this way:
jQuery(document).ready(function($) {
$(document).foundation();
});