jQuery and rails' RJS templates
I'm not sure if I'm going about this the right way but here goes - I am using both jQuery and the rails default libraries (prototype and scriptaculous) in my app, and trying to send jQuery to the browser inside an RJS template or a render(:update) block. It typically looks something like this:
-
page.visual_effect :highlight 'some_div'
page << "jQuery('some_div').css('color', 'red');"
But it doesn't seem to work there. If I put the jQuery inside a js file in the header than all is great, but I also need some stuff in the page code.
I also tried to wrap it inside the document ready call
-
page << "jQuery( function () { jQuery('some_div').css('color', 'red'); });"
But not much happened there either.
Could this be done or am I just wasting my time?