How do I share jQuery script between pages?
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.
精彩评论