I have a blog
controller generated using scaffold with multiple views: index
, edit
, new
, etc.
I have some javascript that adds a class to all div elements:
$('div').each
This function is in a script tag on my index.html.erb page. However it applies the changes to divs across all views in the controller. So when I navigate from index to edit I get the styled divs instead of the plain ones.
How can I limit the function to only work in the index view?
Aucun commentaire:
Enregistrer un commentaire