###前提・実現したいこと
railsにて画面遷移時にある要素を隠したまま表示させたいのですが現状は遷移先では表示されたままとなり、同じURLを踏めば隠されるのですが本来の実装ではありません
###発生している問題・エラーメッセージ
エラーはありませんが、隠すべきものが表示されたままになります
###該当のソースコード
javascript
1$(function(){ 2 3 $('#form-modal').css('display', 'none'); 4 5 6}); 7
Ruby
1<%= form_for(@article) do |f| %> 2 <% if @article.errors.any? %> 3 <div id="error_explanation"> 4 <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2> 5 6 <ul> 7 <% @article.errors.full_messages.each do |message| %> 8 <li><%= message %></li> 9 <% end %> 10 </ul> 11 </div> 12 <% end %> 13 <div id="form-modal"> 14 <div class="field"> 15 <%= f.select :category ,Article.categories.keys.to_a%></div> 16 <div class="field"> 17 <%= f.label :title %><br> 18 <%= f.text_field :title %> 19 </div> 20 <div class="field"> 21 <%= f.label :description %><br> 22 <%= f.text_area :description %> 23 </div> 24 <div class="field"> 25 <%= f.label :content %><br> 26 <%= f.text_area :content ,size: "60x60"%> 27 </div> 28 </div> 29 <div class="actions"> 30 <%= f.submit %> 31 </div> 32 <script src="articleForm.js"></script> 33<% end %>
回答1件
あなたの回答
tips
プレビュー