< %= javascript_tag :defer => 'defer' do -%>
alert('this is a view.html.erb')
< % end -%>
Another way is as follows
This goes in the application.html.erb
< script type="text/javascript">
$(document).ready(function() {
<%= yield :javascript %>
});
< /script>
And in the view we use content_for
< %= content_for :javascript do -%>
alert($)
< % end -%>
No comments:
Post a Comment