I put some js code in the application.js fileand it does not work...
application.js:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//...
obj.dd.on('click', function(event){
$(this).toggleClass('active');
return false;
});
//...
$(function() {
var dd = new DropDown( $('#dd') );
$(document).click(function() {
// all dropdowns
$('.wrapper-dropdown-5').removeClass('active');
});
});
also iI activated a line in the initializers/assets.rb file:
Rails.application.config.assets.precompile += %w( search.js )
but anyway my code is unavailable for using in a view. I think there should be nothing extra, as it is in the application.js.
Or may be there should be something else?