I'm making a blog like this, and I'm trying to implement a function that opens a folder when I touch the gray camera part.

However, an error Uncaught ReferenceError: jQuery is not defined at can be found by examining the Chrome console. This proved that JQuery was not loaded or defined by searching.
<% = form_for article do | f |%>

<% = image_tag 'grey-bg.jpg', class: 'article-image'%>

<% = f.attachment_field: image%>

<% = f.label: title, 'title'%>
<% = f.text_field: title, class: 'form-control'%>

<% = f.label: body, 'Body'%>
<% = f.text_area: body, rows: 10, class: 'form-control'%>

<% = f.submit class: 'btn btn-success'%>
<% end%>
---------------------ー ー ー ー ー ー
$('# cover-image'). click->
$('# article_image'). click ()
Here is the code.
It has been about an hour and a half after searching for typographical errors or description errors.
Please give me a professor.

  • Answer # 1


    js looks something like this, but I don't know why I get an error ...

    Probably because jQuery body is not loaded.

Related articles