如何从rails中的html标记调用javascript函数?

如何从rails中的html标记调用javascript函数?,javascript,jquery,html,ruby-on-rails,Javascript,Jquery,Html,Ruby On Rails,我有一个js文件,它有一个函数,还有一个html文件,我从中调用js函数。我做了一些事情,它能够找到js文件的路径,但它无法找到js文件中的函数。有什么帮助吗?这很重要? index.html.erb <html> <html> <head> <%= javascript_include_tag "graph.js" %> </head> <body> <input type="butt

我有一个js文件,它有一个函数,还有一个html文件,我从中调用js函数。我做了一些事情,它能够找到js文件的路径,但它无法找到js文件中的函数。有什么帮助吗?这很重要?
index.html.erb

<html>
 <html>
   <head>
   <%= javascript_include_tag "graph.js" %>
   </head>
   <body>
   <input type="button" onclick="popup()" value="Click Me!">
     <p>Hello!</p>
   </body>
 </html>

错误在javascript\u include\u标记中

应该是:

<%= javascript_include_tag "graph" %>


还有。。确保graph.js位于app/assets/javascripts

中,可能只是尝试放置一个;在您的
onclick
属性中的
popup()。
<%= javascript_include_tag "graph" %>