Hi, I downloaded the unobtrusive_javascript pluing from this link (http://www.lukeredpath.co.uk/index.php/2006/06/06/introducing-unobtrusive-javascript-for-rails/) since I needed to have dynamic content in javascript (for a pop-up menu). 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. Thanks! -- Posted via http://www.ruby-forum.com/.
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 loaded. -- Dan Webb http://www.danwebb.net
Also make sure you have <%= javascript_include_tag :defaults %> In the head of your document. On 7/22/06, Dan Webb <dan@danwebb.net> wrote:> 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 > loaded. > > > -- > Dan Webb > http://www.danwebb.net >-- Dan Webb http://www.danwebb.net
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 Webb wrote:> Also make sure you have > > <%= javascript_include_tag :defaults %> > > In the head of your document.-- Posted via http://www.ruby-forum.com/.