对应于Form标签的定义:

form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)

为生成的Form的Html添加Javascript使用类似下面的写法:

<% form_tag({ },{ :onsubmit => 'alert("fdsfsad")' }) do %>

生成的Html如下:

<form action="/login/login" method="post" onsubmit="alert(&quot;fdsfsad&quot;)">

相关文章:

  • 2021-04-21
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-09-24
  • 2022-01-01
猜你喜欢
  • 2021-12-12
  • 2021-12-22
  • 2021-12-03
  • 2021-11-11
  • 2021-09-09
相关资源
相似解决方案