Hi,
Can someone explain to me why is this behaviour please?
The code below only works if I reload the page. It does not work when
the
page is loaded through a link. I imagine
that part of the problem is turbolink and ajax, then how do I solve this
problem? I did try to move the javascript tag from the top to
the bottom of the page in the application layout, but that gave me
trouble.
I am using cocoon and every time I want to use a nested
attribute instead of a single copy I am getting multiple. An undesired
feature.
Thank you
-Luis
This is my application.js
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require turbolinks
//= require cocoon
//= require bootstrap.min.js
//= require_tree .
–
search_button.coffee
jQuery ->
$(’.search-box’).hide()
$(’.search-btn’).click ->
$(’.search-box’).toggle(“slow”)