给html element添加触发事件
Rails 中给html element添加触发事件:form_for要写到:html=>{}里面,
<% form_for(@track,:url => { :action => "create" } , :html => { :multipart => true , :onsubmit=>"$('#track_position_x').value.replace(/,/g,',');$('#track_position_y').value.replace(/,/g,',');"} ) do |f| %>
text_field要写到:html=>{}外面
<%=f.text_field :position_y,:onkeyup=>"this.value.replace(/,/g,',');"%>
DHH怎么这么写。。。。
页:
[1]