开发者

How do I share jQuery script between pages?

开发者 https://www.devze.com 2022-12-16 23:27 出处:网络
what is the best way to share jQuery code between pages? this is the situation: -------SITUATION---------

what is the best way to share jQuery code between pages? this is the situation:

-------SITUATION---------

I have several different pages that goes this way (pseudo code)

 <% render "content/link" , collection => required_links %>

In the "content/link" partial

 <div class="element_to_be_changed"/>

Currently in EVERY PAGE that renders the partial, i call

 jQuery.('.element_to_be_changed')... effect that i want...

This strik开发者_开发百科es me as unscalable, but i am not sure what is the best way to handle it. anyone has any ideas?


If it is exactly the same on each page put it in an external script and include the script in the pages that use it.

0

精彩评论

暂无评论...
验证码 换一张
取 消