Damián M. González
2014-Jun-18 06:44 UTC
*.js file not rendered when requesting from <a> HTML element
Hello people, I'm wondering why this is not working. I have some plain JavaScript wrote on mycontroller.js , works like a charm; I'm listening to few events of the related view and works. I've been writing some code, testing it manually refreshing the page in the browser and goes ok. The problem arise when I come to this view from another view. I have a side-bar, when I click an <a> element it calls another action and render another view. When I click the link which takes me to an action of `mycontroller` controller the JavaScript work doesn't work, doesn't get executed. Why is this? I'm listening to the events by: window.onload = function() { document.getElementById('my_element').onclick = function() { // do stuff... } // another listen... } I'm wondering if I should use another event more than window.onload , perhaps that doesn't get triggered when I come to this specific view from an <a> HTML element. Do you have any clue about what's happening? Thanks for your time, I appreciate it. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dc0697963f68e3b161108d0fc47b41d5%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.