简体   繁体   中英

RoR render partial with javascript

I am having trouble rendering a partial with javascript.

I need the javascript to be part of the document, but for some reason when inspecting the document the javascript is not there.

Is there a way to render a partial with javascript so it is part of the document?

If you are using erb templates, then make sure you are using the proper tags. Something like this <%= render :partial => 'mypartial' %>, so that the content of that partial shows up.

In that partial, you can have some javascript code inside some script tags.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM