Unobtrusive Javascript plugin


I downloaded the unobtrusive_javascript pluing from this link
since I needed to have dynamic content in javascript (for a pop-up

Unfortunately I have been unable to make the plugin work. I followed the
instructions on the website, but for some reason the javascript doesnâ??t
work (for example there is no mouseover). Iâ??ve obviously changed the CSS
id to mine. In fact Iâ??ve tried with several ids. The WEbrick server logs
tell me that /unobtrusive_javascript/generate is being fetched ok. In
the plugin controller, I did a â??putsâ? for the @behaviour object and that
too has the correct behaviour that I passed using registerjsbehaviour.

I was wondering if someone has used this plugin and could point me in
the right direction.


I’ve had a look at the code, I should be able to help you out.

Did you get any JavaScript errors?

Have a look in your public/scripts dir and check if event-selectors.js
is there. If not change to the plugins directory and do:

rake update_scripts

Also, if you use the firebug extension for firefox you’ll be able to
more easily diagnose the problem by looking at what scripts are

Also make sure you have

<%= javascript_include_tag :defaults %>

In the head of your document.

Dan, I fixed the problem by including the events-selectors.js file
specifically. Initially I had <%= javascript_include_tag :defaults %>
but it wasn’t working so I removed that didn’t try it again.

Dan W. wrote:

Also make sure you have

<%= javascript_include_tag :defaults %>

In the head of your document.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs