【问题标题】:add :onchange => "readURL(this)" to input file on simple_form添加 :onchange => "readURL(this)" 到 simple_form 上的输入文件
【发布时间】:2012-05-07 11:32:07
【问题描述】:

我对此有疑问:

我想将:onchange => "readURL(this)" 添加到我的:

<%= f.input :image, :as => :file, :onchange => "readURL(this)" %>

我试过了:

<%= f.input :image, :as => :file, :html => {:onchange =>
"readURL(this)"} %>

但我在 html 代码中看不到 onchange="readURL(this)"

我该如何解决这个问题?

再次感谢您:D。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1 simple-form


    【解决方案1】:

    修复:

    <%= f.input :image, :as => :file, :input_html => {:onchange => "readURL(this)"} %>
    

    感谢卡洛斯·安东尼奥·达席尔瓦。

    http://groups.google.com/group/plataformatec-simpleform/browse_thread/thread/6f2cdd83e2dbf51c

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-15
      • 2012-03-23
      • 1970-01-01
      • 1970-01-01
      • 2016-11-23
      • 1970-01-01
      • 2016-12-07
      相关资源
      最近更新 更多