Dom:loaded in application.js and view

I register ajax listeners in my application.js in the dom:loaded
function. In some of my views I also need to use the dom:loaded event
to do other javascript stuff. Since I already have my dom:loaded in
application.js, can I specify another dom:loaded in the script tag in
my view or is there a better way to do it?

I know this could be a prototype question, but since this is rails, I
thought someone might have tried this already.

Thanks

badnaam wrote:

I register ajax listeners in my application.js in the dom:loaded
function. In some of my views I also need to use the dom:loaded event
to do other javascript stuff. Since I already have my dom:loaded in
application.js, can I specify another dom:loaded in the script tag in
my view or is there a better way to do it?

I know this could be a prototype question, but since this is rails, I
thought someone might have tried this already.

http://guides.rubyonrails.org/layouts_and_rendering.html#using-content-for

Specifically this part:

The content_for method is very helpful when your layout contains
distinct regions such as sidebars and footers that should get their own
blocks of content inserted. It’s also useful for inserting tags that
load page-specific javascript or css files into the header of an
otherwise generic layout.

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