Reputation: 28164
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 strikes me as unscalable, but i am not sure what is the best way to handle it. anyone has any ideas?
Upvotes: 0
Views: 156
Reputation: 3604
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.
Upvotes: 4